Archive for the ‘linux’ Category

Shell xargs to automate routine actions

find . -type f -name "*.php.orig" -print | xargs rm $1

Docker how-to see mounted volumes

# docker inspect -f "{{ .Mounts }}" aghayevcom [{bind /home/user/Projects /home true rprivate} {bind /home/user/Servers /opt true rprivate}]

Progress bar in command line

Copying files using rsync with progress bar apt-get install rsync; rsync -ah –progress /path/to/source /path/to/destination Run sql script to restore db with progress bar apt-get install pv; pv script.sql | mysql -h hostname -u username -p password database

How to use screen utility which is better than nohup

Step 1. As a result of running the command it takes you inside newly created session screen -S sessionname Step 2. Run your command and then press the combination below to exit the screen Ctrl+A then D (after releasing Ctrl + A) Step 3 screen -ls Output: There is a screen on: 3132.sessionname (01/27/2020 05:50:32 […]

How-to get size of some folder

du -sh /var du -sh mysql/* du -sh .

How to mount and unmount remote directory

Mounting mkdir ~/remoteDir ssh-keygen -t rsa ssh-copy-id -i .ssh/id_rsa.pub user@hostname sudo apt install sshfs sshfs user@hostname:/ ~/remoteDir Unmounting fusermount -u ~/remoteDir

Apt sources.list to add or remove deb installation repositories

vi /etc/apt/sources.list

Convert mp4 to mp3

ffmpeg -i wombsounds.mp4 -f mp3 -ab 192000 -vn wombsounds.mp3

How-to disable screen lock (screensaver) on Ubuntu

Applications -> System Settings -> Brightness & Lock -> Lock On/Off

Unbuntu language switching customize shortcut

System Settings -> Typing -> Switch to Next Source System Settings -> Typing -> Switch to Previous Source