Linux
Display "Hello"
shell
echo "Hello" && echo 'World !'Write a file
shell
# nano file.txt
vim file.txtOverwrite the file content and add a new line
shell
echo "Erase content" > file.txt && echo "Add this" >> file.txtRead the file content
shell
cat -n file.txtSearch in a file
shell
grep -n "this" file.txtRequest "ROOT" rights
shell
sudo suUnzip a zip
shell
tar -zxvf tar.gzForce deletion of a file
shell
rm -rf document.txtCopy a file
shell
cp file.txt /home/user/download/file.txtMove a file
shell
mv file.txt /home/user/download/document.txtConfigure the keyboard in "AZERTY"
shell
setxkbmap frView command history
shell
cat .bash_historyView "NGINX" error logs
shell
cat /var/log/nginx/error.logSee running "NGINX" processes
shell
ps aux | grep nginxCreate a basic authentication file
shell
sudo sh -c "echo -n 'username:' >> /etc/nginx/.htpasswd"Add password to basic authentication file
shell
sudo sh -c "openssl passwd -apr1 >> /etc/nginx/.htpasswd"Get current date
shell
dateShow formatted date
shell
echo "$(date + '%d/%m/%Y %H:%M')"Edit scheduled tasks
shell
crontab -eRun a script every day at midnight
shell
# m h dom mon dow command
0 0 * * * /home/script.shFile "DOS" To "UNIX"
sed -i 's/\r//'Transfer a file via SSH
shell
scp -r -p /path/to/file user@host:/path/to/destCount the number of lines in a "GIT" project
shell
git ls-files | xargs cat | wc -lCount the number of 'JavaScript' lines in a "GIT" project / per file
shell
git ls-files *.js | xargs wc -l