- Change user of directory
sudo chown -R user:group /parent_dir
- Move dir / file
mv /home/user/test.txt /tmp/
mv test.txt test2.txt
- Extract Tar
tar -xvzf community_images.tar.gz
- Find SUID files
find / -perm -u=s -type f 2>/dev/null
- Find word in dir
find / -type f -exec grep -H 'text-to-find-here' {} \;
- Find where alias or command is based
grep -r 'sudo' ~
- Find directory
find . -name "dirname" -type d
- Find File more
find . -name testfile.txt
find /home -name *.jpg
- info where command is located
type commandname
type rm
- SSH copy to remote
rsync -av dir/ user@domain.de:dir
- mount drive
lsblk
sudo mount /dev/your-drive-from-lsblk /your-dir-you-want-to-mount
sudo mount /dev/sda1 /mnt/ext-2-tb
- umount
- umount /dev/sda1
- force umount
- umount -l /dev/sda1
- copy with progress status
rsync --progress -a sourceDirectory destinationDirectory
- move with rsync
rsync -a --progress --remove-source-files src/test/ dest
- download file via curl
curl http://example.com --output my.file
- download and execute
bash <(curl -s http://mywebsite.com/myscript.txt)
- Change only year of machine
date --set="$(date +'2013%m%d %H:%M')"
- List disk size
df -H
- Taskmanager | show resources
top
htop
Disable Suspend and Hibernation in Linux To prevent your Linux system from suspending or going into hibernation, you need to disable the following systemd targets:
$ sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target