Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- COMMANDS
- ========
- clear >>> clear_terminal
- history >>> history of commands used
- pwd >>> print_working_directory
- ls >>> list
- cd >>> change_directory (cd - or cd [/abs.path] - to go upwards; cd [/rel.path] - to go downwards)
- cd / >>> root directory
- cd ~ >>> home directory
- cd - >>> one step up
- mkdir >>> make_directory (mkdir [dir_name(s)])
- rmdir >>> remove_directory(ies) (empty ones only)
- cp >>> copy_paste (cd [source_files destination])
- rm >>> remove_file (rm [file_name(s)])
- mv >>> move_file(s)_or_directory(ies) (mv [path(s)/name] [optional: path(s)/new_name] destination)
- find >>> search for files by name, by type, last time it was accessed, last time it was modified (find [location] -name ['filename'])
- id >>> identificates uid (user id), gid (group id) and groups user belongs to
- groups >>> list groups user belongs to
- chmod >>> change_mod (chmod u/g/o+/-/=r/w/x file(s)) >>> sets user/group/other permissions to read/write/execute files
- stat >>> file_status
- chown >>> change_owner (chown [new_owner][:new_group] file...)
- !! >>> run last command (e.g. sudo !!)
- type >>> gets the command type (usually used with -t flag)
- alias >>> e.g. alias d=date >>> 'date' command is now accessed with 'd'
- unalias >>> e.g. unalias d >>>. 'date' command is no longer accessed with 'd'
- compgen >>> completion_generation (completes commands with Tab)
- man >>> manual >>> explains command (e.g. man pwd)
- whatis >>> short definition of a command (e.g. whatis pwd)
- help >>> explains builtins (e.g. help pwd)
- less >>> terminal pager which inspects contents of text files (e.g. 'less <file_name>...')
- wc (e.g. 'wc file_name') >>> word_count >>> (x y z) >>> x=lines count, y=words count, z=bytes count;
- wc -m >>> characters count
- wc -l >>> lines count
- head >>> reads first 10 rows of a file (e.g. head file_name); '-n K' >>> read first K lines; '-n -K' >>> read all but last K lines
- tail >>> reads last 10 rows of a file (e.g. tail file_name); '-n K' >>> read last K lines; '-n +2' >>> read all but first line
- column >>> show results in two side-by-side columns, instead of a one long list (e.g. column file_name);
- column -s"<delimiter>" -t file_name >>> prettyprint small tables (larger tables with 'less')
- shuf >>> shuffle (e.g. shuf [-n K] file_name) >>> extract random lines from a file
- file >>> determines the type of a file (e.g. file file_name); 'file *' >>> displays types of all files inside a folder
- cat >>> concatenates the contents of the arguments/files (in order) and displays them (e.g. 'cat <arg1> <arg2>');
- displays the contents of a file (although it is a 'cat abuse', it is common practice as well)
- tac >>> same as cat but reverses the order of the lines (while keeping the order of the files)
- sort >>> sorts lines of text file(s) lexicographically (e.g. sort [-g]|[-r]|[-u]... <file_name>...);
- sorts by columns (e.g. sort -t',' -k3,3gr file_name); without '-g' - lexicographically, with '-g' - numerically
- cut >>> cuts certaing columns from table (e.g. cut -d"," -f2,5 example_data.csv);
- -d >>> delimiter; -f >>> fields/columns (could be a range as well> -f1-3)
- grep >>> global_regular_expression_print
- echo/printf >>> same as print (e.g. echo 'say something')
- > --- redirection operator >>> input > redirection > output (e.g. echo 'text' >'new_file_name' >>> creates new file with that text)
- --- can be used with cat grep sort less help ...(e.g. cat 'file_name_1' 'file_name_2' >'new_file_name_3')
- --- >empty_file
- --- >/dev/null (moving something to null device)
- >> --- redirection operator with appending functionality
- --- echo -n '' >>empty_file
- touch >>> changes time stamp and can create more than one empty files (e.g. touch <file_name_1> <file_name_2>
- | >>> pipe >>> connects the output of the first command into the input of the second command (e.g. <command_1> | <command_2>)
- OPTIONS/FLAGS
- =============
- / >>> root directory
- -p >>> appends slash (/) at the end of a folder
- -A >>> all >>> displays all the files and folders (incl. hidden, starting with .)
- -a >>> all >>> displays all the files and folders (incl. .(current) and ..(parent) directories)
- -l >>> long >>> displays metadata of the files (eg. ls -l)
- -h >>> human_readable
- -i >>> interactive_mode >>> raises command confirmation
- -R >>> recursive >>> used with cp to copy directory; used with rm to remove directory
- --help >>> explains files (e.g. 'pwd --mv')
- WILDCARDS
- =========
- * >>> matches any character, any number of times, except leading dots (.)
- ? >>> matches any character exactly one time
- [] >>> matches any characters inside (only once)
- ! >>> matches everyhing but whatever character follows it
- character class and bracket expressions:
- https://www.gnu.org/software/grep/manual/html_node/Character-Classes-and-Bracket-Expressions.html
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement