#cat
Print a file
cat file [file2 ...]cat notes.txtPrint the whole file
cat -n script.shPrint with line numbers
cat a.txt b.txt > all.txtJoin two files into a new file
catPrint a file
cat file [file2 ...]cat notes.txtPrint the whole file
cat -n script.shPrint with line numbers
cat a.txt b.txt > all.txtJoin two files into a new file
lessRead a long file page by page
less fileless /var/log/syslogOpen a log; use arrows or Space to move, / to search, q to quit
less +F app.logOpen and follow new lines as they arrive (Ctrl+C to stop following)
headShow the first lines
head [-n N] filehead -n 5 data.csvFirst five lines
head -c 100 file.binFirst 100 bytes
tailShow the last lines
tail [-n N] filesudo tail -n 50 /var/log/nginx/error.logLast 50 lines (most files in /var/log need sudo)
sudo tail -f /var/log/syslogKeep watching new lines as they are added (Ctrl+C to stop)
tail -F app.logSame, but keeps going if the log is rotated
nanoSimple text editor
nano filenano /etc/hostsOpen a file (use sudo for system files)
vimPowerful text editor
vim filevim config.ymlOpen a file. Press i to type, Esc to stop typing
vim +42 app.pyOpen at line 42
teeShow output and save it too
command | tee filels -l | tee list.txtPrint the list and also write it to list.txt
echo "127.0.0.1 test" | sudo tee -a /etc/hostsAppend a line to a root-owned file (plain > would fail)
wcCount lines, words and bytes
wc [-l] [-w] [-c] filewc -l access.logCount lines
ls | wc -lCount how many files are in the folder
nlNumber lines
nl filenl script.shPrint the file with numbered lines
SSH Command is a desktop app for Mac, Windows and Linux that puts a real terminal, SFTP file panes, a sudo switch and a searchable Linux command finder in one window. Type what you want to do, and send the command to your server with one click.
Download free Windows commands with examples SFTP & FTP client