Shell commands

df -h
du -hs folder/
du -ck | sort -nr | head -n 10
pwd
uname -a
lsb_release -a
grep -ril mot_a_chercher .
# examples :
sudo /etc/init.d/nom_du_service restart
sudo service nom_du_service restart
apache2ctl restart
find . -maxdepth 1 -ctime +29 -exec rm {} \;
find . -name ".svn" -type d -exec rm -rf {} \;
find . -iname '*.png'
find . -type f | wc -l
grep -nri (my_term) ~/logs_*
tar -zcvf tar-archive-name.tar.gz source-folder-name
tar -zxvf tar-archive-name.tar.gz source-folder-name
sudo apt-get install anacron
sudo vim /etc/cron.daily/newfile
( | tee -a /var/log/anacron_newfile.log)
~ cat /etc/cron.daily/auto-upgrade 
#!/bin/sh

date | tee -a /var/log/anacron_auto-upgrade.log
apt-get -y update && apt-get -y upgrade | tee -a /var/log/anacron_auto-upgrade.log
diff -bur <folder1> <folder2>
sudo passwd <username>
vim /etc/sudoers.d/{{ user }}-sudoer
{{ user }} ALL=(ALL:ALL) NOPASSWD: ALL
vim /etc/init.d/rc.local
{{ anything }}
sudo update-alternatives --all
sed -n 20,40p myfile
zip -r myfile.zip mydir
unzip myfile.zip

# alternative : zip directly to the root folder
cd mydir/ && zip ../myfile.zip -r .
<any-command>  > /dev/null 2>&1 &
gpg --gen-key
  • shell.txt
  • Last modified: 2019/07/15 21:02
  • by jdx