Unix/Linux Command Reference .com File Commands ls 3 directory listing ls -al 3 formatted listing with hidden files cd dir - change directory to dir cd 3 change to home pwd 3 show current directory mkdir dir 3 create a directory dir rm file 3 delete file rm -r dir 3 delete directory dir rm -f file 3 force remove file rm -rf dir 3 force remove directory dir * cp file1 file2 3 copy file1 to file2 cp -r dir1 dir2 3 copy dir1 to dir2 ; create dir2 if it doesn't exist mv file1 file2 3 rename or move file1 to file2 if file2 is an existing directory, moves file1 into directory file2 ln -s file link 3 create symbolic link link to file touch file 3 create or update file cat > file 3 places standard input into file more file 3 output the contents of file head file 3 output the first 10 lines of file tail file 3 output the last 10 lines of file tail -f file 3 output the contents of file as it grows, starting with the last 10 lines Process Management ps 3 display your currently active processes top 3 display ... more. less.
all running processes kill pid 3 kill process id pid killall proc 3 kill all processes named proc * bg 3 lists stopped or background jobs; resume a stopped job in the background fg 3 brings the most recent job to foreground fg n 3 brings job n to the foreground File Permissions chmod octal file 3 change the permissions of file to octal , which can be found separately for user, group, and world by adding: Ï 4 3 read (r) Ï 2 3 write (w) Ï 1 3 execute (x) Examples: chmod 777 3 read, write, execute for all chmod 755 3 rwx for owner, rx for group and world For more options, see man chmod . SSH ssh user@host 3 connect to host as user ssh -p port user@host 3 connect to host on port port as user ssh-copy-id user@host 3 add your key to host for user to enable a keyed or passwordless login Searching grep pattern files 3 search for pattern in files grep -r pattern dir 3 search recursively for pattern in dir command | grep pattern 3 search for pattern in the output of command locate file 3 find all instances of file System Info date 3 show the current date and time cal 3 show this month's calendar uptime 3 show current uptime w 3 display who is online whoami 3 who you are logged in as finger user 3 display information about user uname -a 3 show kernel information cat /proc/cpuinfo 3 cpu information cat /proc/meminfo 3 memory information man command 3 show the manual for command df 3 show disk usage du 3 show directory space usage free 3 show memory and swap usage whereis app 3 show possible locations of app which app 3 show which app will be run by default Compression tar cf file.tar files 3 create a tar named file.tar containing files tar xf file.tar 3 extract the files from file.tar tar czf file.tar.gz files 3 create a tar with Gzip compression tar xzf file.tar.gz 3 extract a tar using Gzip tar cjf file.tar.bz2 3 create a tar with Bzip2 compression tar xjf file.tar.bz2 3 extract a tar using Bzip2 gzip file 3 compresses file and renames it to file.gz gzip -d file.gz 3 decompresses file.gz back to file Network ping host 3 ping host and output results whois domain 3 get whois information for domain dig domain 3 get DNS information for domain dig -x host 3 reverse lookup host wget file 3 download file wget -c file 3 continue a stopped download Installation Install from source: ./configure make make install dpkg -i pkg.deb 3 install a package (Debian) rpm -Uvh pkg.rpm 3 install a package (RPM) Shortcuts Ctrl+C 3 halts the current command Ctrl+Z 3 stops the current command, resume with fg in the foreground or bg in the background Ctrl+D 3 log out of current session, similar to exit Ctrl+W 3 erases one word in the current line Ctrl+U 3 erases the whole line Ctrl+R 3 type to bring up a recent command !! - repeats the last command exit 3 log out of current session * use with extreme caution.<br><br>