Linux Commands

From Lucca's Wiki
Jump to navigationJump to search

Move all files that aren't folders into a folder

mv -- *(.) other_directory/

Nmap ping scan an entire subnet very quickly

sudo nmap -T5 -sn 192.168.0.0/24

Delete all docker images

docker rmi -f $(docker images -a -q)

Create a file and set its permissions

install -m 755 /dev/null filename.txt

Record audio files

Record Audio Files in the Command Line

Get/Set data from clipboard:

getclip () {
       xclip -selection c -o
}
setclip () {
       xclip -selection c
}

Create an SSL Key and Cert pair

openssl req -new -x509 -nodes -out server.crt -keyout server.key

Cut a video or audio file into a clip based on seconds

FFmpeg Cut a video to a clip by seconds

Download any yt-dlp supported video, convert it to an mp3, then automatically number it based on the order they were downloaded in the playlist

yt-dlp --extract-audio --audio-format mp3 --output "%(autonumber)s - %(title)s.%(ext)s" {PUT LINK TO PLAYLIST OR VIDEO HERE}

Convert a folder of mp3s into DVD-compatible mpeg2 files (.dvd) while embedding a looping video on them for compatibility, reducing bit rate as low as it can go.

for i in *.mp3; do; ffmpeg -stream_loop -1 -i asteracube.webm -i "$i" -shortest -r 24 -loop 1 -codec:v mpeg2video -b:v 400k -codec:a ac3 -b:a 448 -vf scale=352:240 dvd/"${i%.*}.dvd"; done

Add kernel boot parameters on truenas scale. This command adds "nomodeset" to the kernel parameters. It is auto-applied on reboot.

midclt call system.advanced.update '{"kernel_extra_options": "nomodeset"}'

Get a list of all files with setuid / SUID permissions

find / -perm -4000 -type f -exec ls -la {} 2>/dev/null \;

Expand a partition to fit the whole disk without rebooting [In this case the disk is /dev/nvme0n1 and the partition is 2]

sudo growpart /dev/nvme0n1 2
sudo resize2fs /dev/nvme0n1p2

Print kernel version and CPU architecture

uname -a


Additional Resources:

https://github.com/sujayadkesar/Linux-Privilege-Escalation#9-capabilities

Youtube.com: Common Linux Privilege Escalation: Using Kernel Exploits

Arachnoid.com: How to use SSH

https://github.com/OpenRC/openrc/blob/master/service-script-guide.md

https://www.truenas.com/community/threads/kernel-boot-parameter-how-to-add-to-tn-scale.110109/