Skip to content

Instantly share code, notes, and snippets.

@ArtemKorchunov
Created February 22, 2019 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ArtemKorchunov/f5b2525f2c37f924e8de9f8caf6f9d34 to your computer and use it in GitHub Desktop.
Save ArtemKorchunov/f5b2525f2c37f924e8de9f8caf6f9d34 to your computer and use it in GitHub Desktop.
pwd -> print working directory
ls -l
->
ls - list
-l - long
-la - long + hidden files
Example Output:
-rw-r--r-- 1 cameronnokes staff 0 Feb 19 20:23 index.html
->
user (cameronnokes)
group (staff)
when it was created or last modified (Feb 19 20:23)
the filename (index.html)
cat
->
-n - with line numbers
Comment:
quick overview
less
->
Comment:
To see file without previous commands
Commands:
Shift G - Will jump us to the very end
G - Will jump to the top
/something - highlights each of these matches
xdg-open (Linux) open (MacOS)
->
Commands:
. - open current window
open path/to/file -a TextEdit - open file in texteditor
echo
->
Comment:
Logs out string
Commands:
"something" > file.txt - direct string into the file.txt (do it multiple times it will overwrite the existing file)
mkdir
->
Comment:
like I want to do mkdir a/b/c We try that, it's not going to let us.
Commands:
-p - it will create each of those intermediary directories as needed. If I do a/b/c now, that will create all the folders we need.
rm
->
Comment:
By default only removes files
Commands:
-r - recursively remove the folder and everything in it
-rf - is a sort of a nuclear option (prevents Bash from prompting you for confirmation when you remove a file, as well as erroring out if a file or directory doesn't exist)
mv
->
Commands:
from to - move files
a.js b.js - rename file
src/ lib - renmae folder
lib/* src/ - move all files from lib to src folder
cp
->
Commands:
-R - recursively copy
find
->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment