Files display ls show files ls -a with hidden files ls -l table view ls -lh size in human format ls | wc -l number of files in dir Show path pwd show where you are Go to cd / root directory cd home directory cd ~ same cd .. 1 level up cd ../.. 2 levels up cd - back cd path go to path cd /var/www/html/ go to on unix cd c:/Users/sherb/Git/ go to on win cd /C/ go to C drive on win Read cat file_path show file content in terminal nano file_name.txt read file in nano editor vi file_name.txt read file in vi editor Move content cat file_path_1 > file_path_2 put file_1 content into file_2 ls file_path_1 > file_path_2 put file names at path_1 to the file at path_2 echo string >> file_path add "string" to the end of the file Create folder mkdir folder_name create folder touch file_name.txt create file > file_name.txt same Create file touch file_name.txt create file > file_name.txt same nano file_name.txt create and open file in nano editor vi file_name.txt create and open file in vi editor Copy cp /path_from /path_to copy a file from to cp -a /path_from/ . /path_to/ copy all from folder to another folder scp -r /path_from/ sherb@35.209.92.93:/var/www/html/folder_name copy folder to server via ssh scp -r sherb@35.209.92.93:/var/www/html/folder_name ~/Temp copy folder from server via ssh Move mv /file_path_from /file_path_to move a file mv /file_path_from /file_path_to rename a file Rename mv /file_or_folder_path_from /file_or_folder_path_to move & rename mv ./file_or_folder_path_from ./file_or_folder_path_to rename in the same folder Remove rm -r folder_path remove folder with warnings rm -rf folder_path remove folder without warnings rm -rf *.zip remove files with .zip ext rm * remove all files in folder with warnings rm -f * remove all files in folder without warnings Tar tar czvf ~/Temp/archive.tar.gz -C ~/Temp/ xxx yyy hi.txt archive listed folders and files from ~/Temp/ and put into ~/Temp/archive.tar.gz tar -xf ~/Temp/archive.tar.gz -C ~/Temp/extracted extract the archive archive.tar.gz from folder ~/Temp/ into folder ~/Temp/extracted Zip tar -xvf file_name.tar untar archive file sudo apt install zip unzip install zip zip -r file_name.zip path zip folder with full path zip -r path/file_name.zip ./* zip folder without full path Documentation man command_name documentation for a command Sudo sudo -s stay sudo permanently (Super User DO) Size df -h size of disk du -h path size of folder Open with open . open with finder (mac) start . open with explorer (win) code . open with VSCode new instance code -a . open with VSCode same instance User whoami user name cat /etc/passwd list of users su user_name change user Permission sudo chmod -R 777 /path/ . set the permissions recursively sudo chmod -R 777 /var/www/myVocabGitRemoteRepo/. example sudo chmod +x /file_path make file executable Apps sudo apt install app_name_1 app_name_2 install app on linux sudo apt update latest info about the apps apt list --upgradable list of upgradable apps sudo apt upgrade upgrade all apps that have a newer version sudo apt-get --only-upgrade install app_name install upgrade for the app Reboot sudo reboot reboot Git git add . && git commit -m 'message' && git push git add, commit & push Alias For Bash nano ~/.bashrc code ~/.zshrc Add some shortcuts # Aliases # alias alias_name="command_to_run" # Long format list alias ll="ls -la" alias cl="clear && printf '\e[3J'" # clear with history alias start="npm run start" alias test="npm run test" alias lint="npm run lint" alias tsc="npx tsc" alias vpnoff="launchctl unload /Library/LaunchAgents/com.paloaltonetworks.gp.pangp*" alias vpnon="launchctl load /Library/LaunchAgents/com.paloaltonetworks.gp.pangp*" # Print my public IP alias myip='curl ipinfo.io/ip' # Function to create a folder and navigate into it function mkcd () { mkdir -p -- "$1" && cd -P -- "$1" } Add aliases to your current session source ~/.bashrc Source source filename executes the content of the file passed as argument in the current shell . "/opt/nvm/nvm.sh" && nvm install 16 dot is the alias for the source command SSH ssh sherb@35.217.12.143 connect cd /var/www/html/antonarbus.com go to this web page folder npm i update packages npm run build Keyboard Ctrl + L clean terminal, same as clear Alt + click put cursor close to the click Arrow_Up previous command Ctrl + C exit Ctrl + D log out Ctrl + U delete line Ctrl + A move cursor to the beginning Ctrl + E move cursor to the end Ctrl + Left / Right move cursor one word Search Ctrl + R search command in terminal history Ctrl + R (again) previous found command Ctrl + O or Enter paste found command & execute Ctrl + G exit & remove found command Arrow Left exit & leave found command Ctrl + G exit search mode Process on port sudo lsof -i :3000 check PID of process on port 3000 kill -9 PID kill the process Kill the process kill -9 PID kill the process End of options -- Signify the end of the options rm -f -- "file.txt" Time & date timedatectl Prompt Native stdin way const readline = require('readline').createInterface({ input: process.stdin, output: process.stdout, }); readline.question(`What's your name?`, name => { console.log(`Hi ${name}!`); readline.close(); }); With inquirer package A more complete and abstract solution is provided by the Inquirer.js package. It is even mentioned on the Node.js website const inquirer = require('inquirer'); const questions = [ { type: 'input', name: 'name', message: "What's your name?", }, ]; inquirer.prompt(questions).then(answers => { console.log(`Hi ${answers.name}!`); }); Used it ones to create a selection list const inquirer = require('inquirer') const devDeploy = async () => { const lambdaDirs = await getLambdaDirs() const { dirs } = await inquirer.prompt([{ type: 'checkbox', message: 'Lambdas', name: 'dirs', prefix: ' ', pageSize: 30, loop: false, choices: lambdaDirs.map(lambdaDir => ({ name: lambdaDir, checked: true })) }]) const { actions } = await inquirer.prompt([{ type: 'checkbox', message: 'Actions', name: 'actions', prefix: ' ', choices: [ { name: 'lint', checked: true }, { name: 'npm ci', checked: true }, { name: 'test', checked: true }, { name: 'zip', checked: true }, { name: 'zip to desktop', checked: false }, { name: 're-deploy template', checked: true } ] }]) if (actions.includes('lint')) { await lint() } if (actions.includes('npm ci')) { await npmCi({ dirs }) } if (actions.includes('test')) { await test({ dirs }) } if (actions.includes('zip')) { await zip({ dirs }) } if (actions.includes('zip to desktop')) { await zipToDesktop({ dirs }) } if (actions.includes('re-deploy template')) { await builtTemplateYaml() const packageName = await getPackageName() await packagedTemplateYaml({ packageName }) deploy({ packageName }) } } Useful shortcuts Git push cd ~/Git/antonarbus.com go into folder git add . && git commit -m 'xxx' git add, commit git push git push Deploy Anton Arbus on server ssh sherb@35.217.12.143 connect cd /var/www/html/antonarbus.com go to this web page folder npm i update packages npm run build pm2 restart app restart server pm2 stop app stop server pm2 delete app delete server pm2 start "npm run start" --name app --watch start app in watch mode Send archive to Anton Arbus cd ~/Git/antonarbus.com go into folder rm -r .next remove existing build folder npm run build build production folder tar -czf archive.tar.gz .next package.json next.config.js public compress build folder scp -r ~/Git/antonarbus.com/archive.tar.gz sherb@35.209.92.93:/var/www/html/antonarbus.com/ copy build archive from Win to server ssh sherb@35.217.12.143 connect cd /var/www/html/antonarbus.com go to this web page folder rm -r /var/www/html/antonarbus.com/.next remove existing build folder tar -xf archive.tar.gz extract archive Restart server via PM2 pm2 start "npm run start" --name app --watch start app in watch mode pm2 restart app restart server pm2 stop app stop server pm2 delete app delete server