Skip to content

Instantly share code, notes, and snippets.

@preetampvp
Last active February 3, 2017 04:19
Show Gist options
  • Save preetampvp/6084ce29a8bab074297f53961eeb54b8 to your computer and use it in GitHub Desktop.
Save preetampvp/6084ce29a8bab074297f53961eeb54b8 to your computer and use it in GitHub Desktop.
Linux commands

ctrl-s - freezes the screen, ctrl-q unfreezes it. Useful to stop output without stopping program

at Do job at certain time

cron Execute script at certain intervals (daily, weekly, etc.).

du -k -s directory Get directory size

find rootdir -name filename Look for filename starting with rootdir.

gzip zip/unzip

hexedit filename Edit a file in hex (access raw binary, not ASCII text)

kill-9 pid Kill any process. Signal 9 can't be ignored.

ln -s old new Symbolic link to directory.

netstat Prints open connections, ports, etc.

od -x file Octal dump (print file in octal). -x is hex flag.

ps List processes currently running. try "ps -u username"

reboot Can reboot machine remotely. Do "find / -name reboot"

shutdown now Shuts down a *nix box

su Get superuser priveledges, without logging in as root.

talk name@host Chat with another user

tar cvf myfile.tar files compress

tar xvf myfile.tar extract

tcpdump Print packets received by host. Try -Nt for succint output.

time operation Times how long an operation takes (time a.out)

traceroute dest Print hops from current host to dest (an ip addr or web page).

w or finger List users currently logged on.

ps -u username (get his processes and their pid)

$fpath - path variable

exec $SHELL -l - reload shell

sudo visudo - to edit /etc/sudoers

man hier - man page for directory structure

getfacl filename - to get acl of a file

setfacl -m u:user:rwx filename - to set acl for user on a file

setfacl -r u:user: filename - to remove acl for a user on a file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment