You are on page 1of 2

pwd - Print Working Directory ls [flags] [file] - The list command cd [dirname] - Change directory Absolute and Relative

paths : Absolute begins at /, relative begins from current dir ~ - current user's home dir . - the current dir .. - the parent dir of current dir touch [flags] <file> - creates empty file / adjusts timestamp of specified file if exists File extensions don't matter in UNIX mkdir [flags] <dir> - Makes new directory rm [flags] <filename> - Removes file * - wildcard to select all -i - prompt before deletion rm [flags] <dir> - Removes empty directory rm -r <dir> recursively removes subdirectories cp [flags] <file> <destination> - Copies file from one location to another cp -r <src> <dest> - To copy a complete dir recursively mv [flags] <src> <dest> - Moves a file from one directory to another Also used for renaming (move from <oldname> to <newname> man <command_name> - Brings up the manual page for the selected command /<keyword> to perform a keyword search SuperUser or "root" presides over all accounts -rwxrwxrwx : in this order - user/group/other r=read,w=write,x=execute Directory permissions begin with a d instead of a -rw-rw-r-- means that user and group can read and write and others can read only chmod <mode> <file> - Change Mode u,g,o, or a - all, + or - (add or remove permissions), -rwx (permissions) chmod ug+rx - user and group can read and execute chgrp group <target> - changes group ownership of file <target> chown user:group <target> - changes ownership of file<target> group is optional -R to do a recursive change ln [options] <target_file> [link_name] - Creates link to <target_file> at [link_ name] -s for symbolic link nano filename - Opens filename for editing

cat <filename> - Prints contents of a file more <filename> - Scroll 1 page at a time less < filename> - Scroll up or down head - [numlines] <filename> tail - [numlines] <filename> Prints the first/last numlines of a file, default is 10. echo <text_string> - Prints <text_string> to the terminal <command1> | <command2> - Piping : PAsses the output from command1 to command2 <command1> && <command2> - Immediately after command1 completes, execute command 2 only IF command1 executes successfully <command> > <file> - Redirects output of a command to a file <command> >> <file> - Appends the output instead of overwriting

You might also like