Cheat sheet o: others -P: pattern is a perl regex [options] 3 Network & Remote by A.Mahouachi a: all -m: stop after m matches options: ssh [options] user@host ["cmd1;cmd2"] +: add mode -n: also show matching line number options: -h: human readable 1 File Commands -: remove mode -R: recurse directories -2: force protocol 2 =: exact mode -c: only show matching lines count -i: list inodes info [options] file -P: no dereference of sym links -o StrictHostKeyChecking=no: ignore options r: read –exclude=glob : exclude these warnings due to remote host key w: –include=glob : only consider these 2 Process Commands change -a: show hidden files x: execute files and search for dirs -A: show hidden files except . and .. [options] file(s) [options] -X: forward X11 display X: search for dirs options -d: only show directories s: setuid or setguid options: wget [options] url -h: human readable size t: sticky bit -v: non ascii chars except tab and eol -e: all processes options: -i: inode info -T: show tabs numeric mode -f: full listing -b: run in background -l: long list format -t: equivalent to -vT -H: show hierarchy -o file: print wget output in file -m: output as csv format: [0-7]1,4 -E: show eol end of line example: 755 -p pid: this process pid -o /dev/null: suppress wget output -n: numeric uid and guid -e: equivalent to -vE -C cmd: this name cmd -q: be quiet -r: in reverse order first digit: setuid(4), setguid(2) -A: equivalent to -vET second digit: owner perms -w: wide output -d: debug -S: sort by file size -s: remove repeat empty lines -ww: to show long command lines -O file: save response to file -t: sort by modification third digit: group perms [options] file fourth digit: others perms -l: long listing, including wchan -c: resume file download tree [options] dir options -o x,y,z: show columns x y z -S: print server headers options read: 4 write: 2 -f: show end of file live -o user,pid,cmd: show columns user, -T N: timeout after N seconds -d: only directories execute: 1 -35: show last 35 lines pid command –user=user: basic http auth user -q: be quiet -N: negation –password=password: basic http auth -f: show full paths path [options] [tests] [actions] -P pattern: only matching pattern [options] file -u user: processes owned by user password options: –save-cookies file: save cookies to file -I pattern: except matching pattern options -u user -N: processes not owned by user -h: print sizes in human readable for- -mindepth: start from min level in hier- –sort=x,y: x y are columns in ps output –load-cookies file: use file as cookies mat archy -35: show first 35 lines –sort=user: sort by user –post-data=string -C: use colors -maxdepth: end with max level in hier- -q: be quiet –sort=+time: sort by cpu time asc –post-file=file -L max: max level depth archy tac file(s) –sort=-time: sort by cpu time desc –no-check-certificate: ignore ssl certifi- tests: print files starting from last line –sort=size: sort by memory size cate [options] source dest -name "xyz*": name like xyz* [options] file –sort=vsize: sort by vm size curl [options] url options: options -iname "xyz*": like -name but case in- options top [options] sensitive -b: backup dest before overwrite -d char: use char as delimiter -H header: like -H "Host: st.com" -type d: only directories options -u : basic http auth -r: recursive -type f:only files -f 1,3,5: print fields 1, 3 and 5 -f: force -d x: refresh every x seconds -s: be silent -mtime 0: modified < 1 day uniq [options] input output -p pid1 -p pid2: only processes with -S: show errors if silent mode -l: link files instead of copy -mtime -x: modified < x days options -P: dont follow sym links pid1 pid2 -L: follow new location in case 301 -mtime +x: modified > x days -c: prefix lines by number of occur- -c : show command lines –data "field=value": x-www-form- -i: interactive -mmin: like -mtime but in minutes -u: copy only if source newer than dest rences interactive commands urlencoded query -size +100M: size > 100mb -d: only print duplicate lines space: udpdate display –data-binary data: post data as is wi- [options] source dest -size -100M: size < 100mb (k for kb, G -u: only print unique lines n: change number of displayed proces- thout encoding options for gb) sort [options] file ses –data-binary @filename: post filename -b: backup dest before overwrite -perm /o+w: writable by others options up and down: browse processes content as is -f: force ! -perm /o+r : not readable by others k: a process -X method: use PUT, GET, POST etc. actions: -n: numeric sort o: change order –request method: use PUT, GET, POST -i: interactive -b: ignore blank lines -u: move only if source newer than dest -print: print matching T: sort by time etc. -delete: matching files -f: ignore case [options] file link -r: reverse order A: sort by age mail [options] to-address options -exec cmd ’{}’ ; : run cmd for every P: sort by cpu options: match tar [options] file M: sort by memory -s: sym link (hard by default) -exec cmd ’{}’ + : run cmd the end of options c: display/hide command line -s subject: email with subject -f: overwrite link if exists search -c address1,address2: cc copy -f file: archive file m: display/hide memory -b address1,address2: bcc copy -b: backup old link before overwrite -exec rm -rf ’’ : rm -rf matching items -c: create t: display/hide cpu -fprint /tmp/result: write matches to mail -s ’hello there’ ’[email protected]’ < so- rm [options] file -t: list f: manage list of displayed columns mefile options /tmp/result -x: extract up and down: move between columns -C DIR: to DIR 4 Terminal -f: force di [options] files d: display/hide the selected column Ctrl+C: halt current command -i: interactive options -z: gzip q: apply and quit the field mgmt -j: bzip2 Ctrl+Z: pause current command rm – -foo if file name is -foo screen bg %1: resume paused command in -r: recursive [options] file [options] mode file(s) -w: ignore whitespaces pgrep [options] pattern background options -B: ignore blank lines options: fg %1: resume paused command in fo- options -R: recursive -q: only show file names -c: a grand total reground -x".sync*": exclude files with path like -h: human readable -l : show pid and process name Ctrl+D: logout symbolic mode .sync* -L: dereference sym links -a : show pid and full command line Ctrl+W: remove a word from current format: [ugoa][[+-=][perms]],... -P: no dereference of sym links -n : if than one show newest line example: u+x,o-wx,g-w [options] pattern files -s: total for each argument -o : if more than one show oldest Ctrl+U: remove current line u: owner options –exclude=pattern -u uid : show only processes of uid Ctrl+A: go to beginning of current line g: group -i: ignore case -max-depth=N: dont go deeper than N -c : count results Ctrl+E: go to end of current line