Linux Commands: Difference between revisions

No edit summary
No edit summary
Line 1: Line 1:
Give dolphin emulator flatpak full filesystem access like the non-flatpak version would have
== Flatpak & Applications ==
 
=== Give dolphin emulator flatpak full filesystem access like the non-flatpak version would have ===
  sudo flatpak override --filesystem=host org.DolphinEmu.dolphin-emu
  sudo flatpak override --filesystem=host org.DolphinEmu.dolphin-emu


Copy every iso in the current folder into nintendon't format
 
== File Operations ==
 
=== Copy every iso in the current folder into nintendon't format ===
  for i in *; do mkdir "$(echo $i | sed 's/.iso//')"; mv "$i" "$(echo $i | sed 's/.iso//')"/game.iso; done
  for i in *; do mkdir "$(echo $i | sed 's/.iso//')"; mv "$i" "$(echo $i | sed 's/.iso//')"/game.iso; done


Copy while preserving permissions [Use archive mode, resolve symlinks, and skip files that are newer on the destination]
=== Copy while preserving permissions [Use archive mode, resolve symlinks, and skip files that are newer on the destination] ===
  rsync -auL source-file destination-file
  rsync -auL source-file destination-file


View systemd service logs in real time [system service]
=== Copy with progress bar ===
rsync --progress source_file destination_file
 
=== Move all files that aren't folders into a folder ===
mv -- *(.) other_directory/
 
=== Create a file and set its permissions ===
install -m 755 /dev/null filename.txt
 
 
== System Monitoring & Logs ==
 
=== View systemd service logs in real time [system service] ===
  sudo journalctl -u notification-parse.service -f
  sudo journalctl -u notification-parse.service -f


View systemd service logs in real time [user service]
=== View systemd service logs in real time [user service] ===
  journalctl --user -u notification-parse.service -f
  journalctl --user -u notification-parse.service -f


Copy with progress bar
=== Print kernel version and CPU architecture ===
  rsync --progress source_file destination_file
  uname -a
 


Move all files that aren't folders into a folder
== Networking & Security ==
mv -- *(.) other_directory/


Nmap ping scan an entire subnet very quickly
=== Nmap ping scan an entire subnet very quickly ===
  sudo nmap -T5 -sn 192.168.0.0/24
  sudo nmap -T5 -sn 192.168.0.0/24


Delete all docker images
=== Get a list of all files with setuid / SUID permissions ===
find / -perm -4000 -type f -exec ls -la {} 2>/dev/null \;
 
 
== Docker ==
 
=== Delete all docker images ===
  docker rmi -f $(docker images -a -q)
  docker rmi -f $(docker images -a -q)


Create a file and set its permissions
install -m 755 /dev/null filename.txt


Record audio files
== Clipboard Utilities ==
[[Record Audio Files in the Command Line]]


Get/Set data from clipboard:
=== Get/Set data from clipboard: ===
  getclip () {
  getclip () {
         xclip -selection c -o
         xclip -selection c -o
Line 40: Line 60:
  }
  }


Create an SSL Key and Cert pair
 
== Media & Encoding ==
 
=== Record audio files ===
[[Record Audio Files in the Command Line]]
 
=== Create an SSL Key and Cert pair ===
  openssl req -new -x509 -nodes -out server.crt -keyout server.key
  openssl req -new -x509 -nodes -out server.crt -keyout server.key


Cut a video or audio file into a clip based on seconds
=== Cut a video or audio file into a clip based on seconds ===
  [[FFmpeg Cut a video to a clip by 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
=== 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}
  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.
=== 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
  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.  
 
== Disk & System Management ==
 
=== 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"}'
  midclt call system.advanced.update '{"kernel_extra_options": "nomodeset"}'


Get a list of all files with setuid / SUID permissions
=== Expand a partition to fit the whole disk without rebooting [In this case the disk is <code>/dev/nvme0n1</code> and the partition is <code>2</code>] ===
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 <code>/dev/nvme0n1</code> and the partition is <code>2</code>]
  sudo growpart /dev/nvme0n1 2
  sudo growpart /dev/nvme0n1 2
  sudo resize2fs /dev/nvme0n1p2
  sudo resize2fs /dev/nvme0n1p2
Print kernel version and CPU architecture
uname -a




Additional Resources:
== Additional Resources ==


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

Revision as of 00:23, 24 March 2026

Flatpak & Applications

Give dolphin emulator flatpak full filesystem access like the non-flatpak version would have

sudo flatpak override --filesystem=host org.DolphinEmu.dolphin-emu


File Operations

Copy every iso in the current folder into nintendon't format

for i in *; do mkdir "$(echo $i | sed 's/.iso//')"; mv "$i" "$(echo $i | sed 's/.iso//')"/game.iso; done

Copy while preserving permissions [Use archive mode, resolve symlinks, and skip files that are newer on the destination]

rsync -auL source-file destination-file

Copy with progress bar

rsync --progress source_file destination_file

Move all files that aren't folders into a folder

mv -- *(.) other_directory/

Create a file and set its permissions

install -m 755 /dev/null filename.txt


System Monitoring & Logs

View systemd service logs in real time [system service]

sudo journalctl -u notification-parse.service -f

View systemd service logs in real time [user service]

journalctl --user -u notification-parse.service -f

Print kernel version and CPU architecture

uname -a


Networking & Security

Nmap ping scan an entire subnet very quickly

sudo nmap -T5 -sn 192.168.0.0/24

Get a list of all files with setuid / SUID permissions

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


Docker

Delete all docker images

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


Clipboard Utilities

Get/Set data from clipboard:

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


Media & Encoding

Record audio files

Record Audio Files in the Command Line

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


Disk & System Management

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"}'

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


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/