Shell bash commands
Home > Flashcards > Print Preview
The flashcards below were created by user
on FreezingBlue Flashcards
. What would you like to do?
grep [options] pattern [file]
searches named input FILE (or stdin if no file or - is given) for lines containing a match to given PATTERN. By default, grep prints matching lines.
grep [-v] [$ ^ . *]
- -v --invert match i.e. select non-matching lines
- * --preceding item matched zero or more times
- ^ --matches empty string at beginning of a line
- $ --matches empty string at end of line
- ls [OPTION]... [FILE]...
- lists information about the FILEs, normally sorts alphabetically
- -a --all (dont ignore entries starting with .)
- -i --inode (print index no. of ea file)
- -l --long (use long listing format)
- -d --drectory (list directory entries instead of contents, and do not dereference symbolic links)
Note, you an use multiple options together
ps displays information about a selection of active processes
- -e --select all processes, like -A
- -f --does full format listing
- Note, format for -f is:
- UID, PID, PPID, C, STIME, TTY, TIME, CMD
sort [-r -k]
- sort [OPTION]...[FILE]...
- writes sorted concatenation of all FILE(s) to stdout
- -r --reverse (reverse result of comparisons)
- -k --key=POS1[,POS2] starts a key at POS1 end it at POS2 (default end of line) i.e. sort by POS1 column
- uniq [OPTIONS]...[INPUT[OUTPUT]]
- filters adjacent matching lines from INPUT (or stdin) writing to output (or stdout)
-c --count (prefix lines by no. of occurences)
- cat [OPTION]...[FILE]...
- concatenates FILE or stdin to stdout
putting a - between files will wait for input until ^D given, at which file after - will print
- head [OPTION]...[FILE]...
- prints first ten lines of each FILE to stdout. with more than one FILE, precede ea. with a header giving the file name. With no FILE or -, read stdin.
-n (number) prints out first n lines of first 10
does exactly the same as head but ten lines from the bottom of the file
cut [-f -d]
- cut OPTION...[FILE]...
- removes sections from each line of files
-f --fields=LIST (select only these fields; also print any line containing no delimiter character, unless -s option is specified)
-d --delimiter= DELIM (use DELIM instead of TAB for the field delimiter)
- wc [OPTION]...[FILE]...
- print newline, word, and byte counts or ea. FILE and a total if more than one FILE is specified. reads stdin if no FILE or - is given
-l --lines (print the newline counts)
- Note, format is:
- newlines words bytecount filename
compares files line by line
- 1st line: a added, d deleted and c changed. Line numbers of the original file appear before these letters and those of the modified file appear after the letter.
- < means something in first thats not in second
- > means something in second thats not in first
- chmod [OPTION]...MODE[,MODE]..FILE...
- changes file mode bits of ea. given file according to MODE which can also be octal
- e.g. chmod u+rwx foo
- ugoa (user, group, others, all)
- rwxX (read, write, execute or search for directories, X x only if dirctory or already has execute permissions)
- -v --verbose (output diagnostic for every file)
- -c --changes (only report when change is made, otherwise like verbose)
- -f --silent (suppress most error messages)
- -R --recursive (change files and directories recursively)
- ln make links between files
- ln [OPTION]...TARGET or
- ln [OPTION]...TARGET...DIRECTORY
-s --symbolic link instead of hard
- rm [OPTION]...FILE...
- removes specified file but does not remove directories by default
- -f --force (ignore nonexistent files, no prompting, remove whether protected or not)
- -r --recursive (remove directories and contents)
- mkdir [OPTIONS] DIRECTORY
- creates the DIRECTORIES if they do not already exist
- rmdir [OPT] DIRECTORIES
- removes empty directories
- copy files and directories from SOURCE to DEST or to DIRECTORY
- cp [OPTION] SOURCE DIRECTORY/DEST
-r --recursive (copies recursively)
- mv [OPTION] SOURCE DIR/DEST
- renames SOURCE to DEST, or moves SOURCE to DIRECTORY
- vi like vim is a text editor
- pico is also a text editor
svn [commit add remove move]
svn add files: puts files and directories under version control, scheduling them for addition to repository on the next commit
svn commit [path]: sends changes from working copy to repository
svn remove path/url: removes files and directories from version control
svn [move update info log status diff]
svn move SRC DST: moves or renames something in working copy or repository
svn update [path]: brings changes from repository into working
svn info [target]: displays info about local or remote item
svn status [path]: print status of working copy files and directories
svn diff FILES: displays differences between revisions or paths
- less [OPTIONS]
- displays output one screen at a time, searches through output, edits command line
What would you like to do?
Home > Flashcards > Print Preview