Advertisement
Guest User

Linux Basics

a guest
Dec 15th, 2018
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Awk 3.13 KB | None | 0 0
  1. # for help on any command and its options do
  2. command --help # ex. cd --help; ls --help
  3.  
  4. # usual syntax (way to use)
  5. command -options arguments
  6.  
  7. # you can stack options (ex. -l -a -R = -Rla (order doesnt matter (unless specified in --help))
  8.  
  9.  
  10.  
  11. ### MOVING AROUND AND SEEING SHIT
  12.  
  13. pwd # print current location (directory) (PrintWorkingDirectory
  14.  
  15. cd <folder / directory> # change current working directory
  16. cd .. # go back one folder
  17.  
  18. ls -la # see contents (files) of current working directory; -a show hidden files
  19. #also try
  20. ls -l
  21. ls
  22.  
  23.  
  24. less <file> # see contents of a file
  25.     -page up/down, spacebar, arrow keys for moving around
  26. more <file> # similar to 'less'
  27.  
  28.  
  29.  
  30.  
  31. ###  WILDCARDS - something that replaces characters in file names or searches
  32. * - replaces anything (including a whole word and spaces)
  33. ? - replaces a single character
  34. [characters] - replaces any one character that is in [ ]
  35. [!characters] - replaces any one character that is NOT in [ ]
  36. [:digit:] - replaces a digit
  37. [:alpha:] - alphabetic character
  38. [:alnum:] - alphanumeric character
  39. [:lower:] - lower case letter
  40. [:upper:]
  41.  
  42.  
  43. ex.
  44. * # all files
  45.  
  46. *.txt # all txt files
  47.  
  48. g* # all files that begin with 'g'
  49.  
  50. *g # all files that end with 'g'
  51.  
  52. data??? # files that begin with "data" and are followed by exactly three characters
  53.  
  54. [abc]* # all files that begin with either 'a', 'b' or 'c'
  55.  
  56.  
  57. ### COPY MOVE RENAME CREATE DESTROY
  58. cp # copy
  59. mv # move (also used for renaming) <-----####
  60. # mv behaves the same as cp
  61. mkdir # make directory
  62. rmdir # remove directory
  63. rm # remove
  64.  
  65.  
  66. # Create directories
  67. mkdir dir1 # creates 1 directory with name "dir1"
  68.  
  69. mkdir dir1 dir2 dir3  # creates 3 directories with names "dir1", "dir2" and "dir3"
  70.  
  71.  
  72. # Copy shit around
  73. cp file1 file2 # if file2 exists it is overwritten (deleted and replaced)
  74.  
  75. cp -i file1 file2 # prompts (asks) if you want to overwrite (the "-i" thing allows that)
  76.  
  77. cp file1 file2 dir1 # copies file1 and file2 into directory dir1
  78.  
  79. cp dir1/* dir2 # copies everything from dir1 into dir2
  80.  
  81.  
  82. # Move and rename
  83. #mv behaves the same as cp
  84. mv file1 file2 # renames item1 into item2, and overwrites like cp
  85.  
  86. mv -i file1 file2 # prompts for overwrite, like cp
  87.  
  88. # Delete
  89.  
  90. rm file1 # no prompt
  91.  
  92. rm -i file1 # prompted if you want to delete
  93.  
  94. rm dir1 # will not delete if directory has files or other directories
  95.  
  96. rm -r dir1 # -r (reccursive) deletes dir1 and all its contents
  97.  
  98.  
  99.  
  100. ### USEFUL SHORTCUTS ###
  101.  
  102. Ctrl-Alt-F1 through F6 # (create) virtual console (backup console incase you fuck something up so you can fix your shit)
  103. Alt-F1 through F6 # switch between virtual consoles
  104.  
  105. #usually
  106. Ctrl+Shift+c # copy
  107. Ctrl+Shift+v # paste
  108. Scrollwheel click #paste
  109.  
  110.  
  111.  
  112.  
  113. ### SOME OTHER TERMINAL COMMANDS ###
  114.  
  115. df # print disk space available/used
  116.  
  117. date # print date
  118. cal # print calendar
  119.  
  120.  
  121.  
  122.  
  123. ### OPTIONAL READ ###
  124.  
  125. GUI (graphical(visual) user interface) # graphical programs
  126. CLI (command line interface) # programs used in a terminal
  127.  
  128.  
  129. GUI makes easy tasks easy, CLI makes difficult tasks possible
  130.  
  131. 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