Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # for help on any command and its options do
- command --help # ex. cd --help; ls --help
- # usual syntax (way to use)
- command -options arguments
- # you can stack options (ex. -l -a -R = -Rla (order doesnt matter (unless specified in --help))
- ### MOVING AROUND AND SEEING SHIT
- pwd # print current location (directory) (PrintWorkingDirectory
- cd <folder / directory> # change current working directory
- cd .. # go back one folder
- ls -la # see contents (files) of current working directory; -a show hidden files
- #also try
- ls -l
- ls
- less <file> # see contents of a file
- -page up/down, spacebar, arrow keys for moving around
- more <file> # similar to 'less'
- ### WILDCARDS - something that replaces characters in file names or searches
- * - replaces anything (including a whole word and spaces)
- ? - replaces a single character
- [characters] - replaces any one character that is in [ ]
- [!characters] - replaces any one character that is NOT in [ ]
- [:digit:] - replaces a digit
- [:alpha:] - alphabetic character
- [:alnum:] - alphanumeric character
- [:lower:] - lower case letter
- [:upper:]
- ex.
- * # all files
- *.txt # all txt files
- g* # all files that begin with 'g'
- *g # all files that end with 'g'
- data??? # files that begin with "data" and are followed by exactly three characters
- [abc]* # all files that begin with either 'a', 'b' or 'c'
- ### COPY MOVE RENAME CREATE DESTROY
- cp # copy
- mv # move (also used for renaming) <-----####
- # mv behaves the same as cp
- mkdir # make directory
- rmdir # remove directory
- rm # remove
- # Create directories
- mkdir dir1 # creates 1 directory with name "dir1"
- mkdir dir1 dir2 dir3 # creates 3 directories with names "dir1", "dir2" and "dir3"
- # Copy shit around
- cp file1 file2 # if file2 exists it is overwritten (deleted and replaced)
- cp -i file1 file2 # prompts (asks) if you want to overwrite (the "-i" thing allows that)
- cp file1 file2 dir1 # copies file1 and file2 into directory dir1
- cp dir1/* dir2 # copies everything from dir1 into dir2
- # Move and rename
- #mv behaves the same as cp
- mv file1 file2 # renames item1 into item2, and overwrites like cp
- mv -i file1 file2 # prompts for overwrite, like cp
- # Delete
- rm file1 # no prompt
- rm -i file1 # prompted if you want to delete
- rm dir1 # will not delete if directory has files or other directories
- rm -r dir1 # -r (reccursive) deletes dir1 and all its contents
- ### USEFUL SHORTCUTS ###
- Ctrl-Alt-F1 through F6 # (create) virtual console (backup console incase you fuck something up so you can fix your shit)
- Alt-F1 through F6 # switch between virtual consoles
- #usually
- Ctrl+Shift+c # copy
- Ctrl+Shift+v # paste
- Scrollwheel click #paste
- ### SOME OTHER TERMINAL COMMANDS ###
- df # print disk space available/used
- date # print date
- cal # print calendar
- ### OPTIONAL READ ###
- GUI (graphical(visual) user interface) # graphical programs
- CLI (command line interface) # programs used in a terminal
- GUI makes easy tasks easy, CLI makes difficult tasks possible
- shell is a program that takes keyboard commands and passes them on to the operating system to carry out
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement