Skip to content
- pwd (print working directory)
- ls (list items)
- ~ (home directory)
- cd (change directory)
- cd .. (go up one directory)
- cd / (go to root directory)
- cd ~ (go back to HOME directory)
- cd /Users (goes to USERS dir)
- clear (clears the screen by moving up a little, no info is lost, juts move up a little and you can c it)
- mkdir projects (make a directory)
- touch index.html (creates a new file)
- touch index.html connect.php main.css (will create all these files at once)
- rm (short for remove. This will delete your file immediately and no warnings and it will not be sent to BIN, it will be deleted immediately; by typing multiple files you can just delete multiple files like you could create “touch” many files at the same time)
- rmdir (this will delete an EMPTY directory only. It you have files in it then it cannot be deleted with this command)
- if you want to move a DIRECTORY with files in it, then you should use this command and flag: rm -r samplefolder
- flags in TERMINAL
- ls -s (shows file size)
- ls -l (longer info format)
- You can also combine these two flags like this: ls -ls (this will show more info about
- man -s (this will display MANUAL for TERMINAL commands; you can EXIT manual by using “q”=quit)
- cp data/script.js copied/ (first is full-path with dir name to the file we are trying to copy and the second is folder name where we are coping it; ” / ” is very IMPORANT because it shows the folder exists, if you omit ” / ” then a folder will be created).
- -r (copies all the files from that dir)
- mv (stands for MOVING files; you cannot move many files, but just ONE at a time, but u can move entire FOLDER using this command, flag -r (all files) will not work
- mv command used in the same FOLDER works for renaming files as well.
- mv styles.css styles2.css -> this will rename file styles.css to styles2.css
- this command also works for RENAMING folders as well