Sei sulla pagina 1di 1

FILE COMMANDS PROCESS MANAGEMENT COMMAND LINE FU

ls - directory listing ps - display currently active processes


ls -al - formatted listing with hidden files ps aux - ps with a lot of detail echo "ls -l" | at midnight - execute a
cd dir - change directory to dir kill pid - kill process with pid ‘pid’ command at a specified time
cd - change to home killall proc - kill all processes named proc netstat -tlnp - list all listening ports
pwd - show current directory bg - lists stopped/background jobs, resume stopped job dig +short txt <keyword>.wp.dg.cx - query wikipedia
mkdir dir - create direcotry dir in the background using DNS
rm file - delete file fg - bring most recent job to foreground mount | column -t - mounted filesystems in nice layout
rm -r dir - delete directory dir fg n - brings job n to foreground sshfs name@server:/path/to/folder /path/to/mount/point
rm -f file - force remove file - mount filesystem over SSH
rm -rf dir - remove directory dir FILE PERMISSIONS <space>command - execute command without saving it
rm -rf / - make computer faster in history
chmod octal file - change permission of file
cp file1 file2 - copy file1 to file2 time read (ctrl-d to stop) - stopwatch
mv file1 file2 - rename file1 to file2 net rpc shutdown -I ipAddressOfWindowsPC -U username%password
4 - read (r)
ln -s file link - create symbolic link ‘link’ to file - remotely shutdown windows machine
2 - write (w)
touch file - create or update file (cd /tmp && ls) - jumpt to dir, exec command, jump back
1 - execute (x)
cat > file - place standard input into file to dir
more file - output the contents of the file man ascii - ascii table
order: owner/group/world
less file - output the contents of the file ps aux | sort -nk +4 | tail - top 10 running processes
head file - output first 10 lines of file sorted by memory usage
eg:
tail file - output last 10 lines of file ctrl+l - clear terminal screen
chmod 777 - rwx for everyone
tail -f file - output contents of file as it grows ssh -t reachable_host ssh unreachable_host - ssh through
chmod 755 - rwx for owner, rx for group/world
host in the middle
SSH ARCHIVE/COMPRESSION telnet towel.blinkenlights.nl - watch starwars via telnet
ssh user@host - connect to host as user ping -i 60 -a IP_address - set audible alarm for when IP
tar cf file.tar files - tar files into file.tar
ssh -p port user@host - connect using port p comes online
tar xf file.tar - untar into current directory
ssh -D port user@host - connect and use bind port lsof -i - watch real time network activity
tar tf file.tar - show contents of archive
echo "!!" > foo.sh - create a script of the last command
INSTALLATION tar flags:
curl ifconfig.me - get your external IP
pushd /tmp - push a directory to a stack
./configure
ps aux | grep -i process - find a process you want
make c - create archive j - bzip2 compression
!* - reuse all parameters from previous command
make install t - table of contents k - do not overwrite
du -s * | sort -n | tail - get 10 biggest files in
x - extract T - files from file
NETWORK f - specifies filename w - ask for confirmation
leave +15 the current directory
mv filename.{old,new} - quickly rename file
ping host - ping host ‘host’ z - use zip/gzip v - verbose
vim scp://username@host//path/to/somefile - remotely edit
whois domain - get whois for domain
a file
dig domain - get DNS for domain gzip file - compress file and rename to file.gz
mkdir -p a/long/directory/path - make dir, with many
dig -x host - reverse lookup host gzip -d file.gz - decompress file.gz
intermediate dirs
wget file - download file
chmod --reference file1 file2 - copy perms of file1 to file2
wget -c file - continue stopped download SHORTCUTS ls -d */ - list only the directories
wget -r url - recursively download files from url
ctrl+c - halts current command vi +/pattern [file] - open file in vim, at pattern
SYSTEM INFO ctrl+z - stops current command leave +15 - remind yourself to leave in 15 minutes
fg - resume stopped command in foreground
date - show current date/time bg - resume stopped command in background
cal - show this month’s calendar ctrl+d - log out of current session
uptime - show uptime ctrl+w - erases one word in current line
w - display who is online ctrl+u - erases whole line
whoami - who are you logged in as ctrl+r - reverse lookup of previous commands
uname -a - show kernel config !! - repeat last command
cat /proc/cpuinfo - cpu info exit - log out of current session
cat /proc/meminfo - memory information
man command - show manual for command COMMAND LINE FU
df - show disk usage
du - show directory space usage sudo !! - run the last command as root
du -sh - human readable size in GB python -m SimpleHTTPServer - serve current directory
free - show memory and swap usage tree at http://$HOSTNAME:8000/
whereis app - show possible locations of app :w !sudo tee % - save a file you edited in vim
which app - show which app will be run by default without the needed permissions
cd - - change to previous working dir
SEARCHING !whatever:p - check command history, but avoid running
grep pattern files - search for pattern in files it
grep -r pattern dir - search recursively for > file.txt - empty a file
pattern in dir ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq /tmp/out.mpg
command | grep pattern - search for for pattern - capture video of linux desktop
in in the output of command
locate file - find all instances of file