:wq
= write changes and quit Vi editor:q!
= DO NOT write changes and quit Vi editorpwd
= print working directory's namecat [filename]
= used when you want to view the contents of a filels
= list all contents of a directoryls -a
= list all contents of a directory with hidden filestouch [file-name]
= creates a new filerm [file-name]
= removes or deletes a fileopen [file-name]
= open file
Use ;
to make multiple commands
mkdir one_folder second_folder ; touch one.html two.html ; mkdir first_day_stuff ; mv one.html first_day_stuff ; mv two.html first_day_stuff
Run nano index.html
TIP: For a web page or app, make sure the index.html
is created in the path var/html/public
Then, press Control + "C"
to exit Nano editor
- Nano editor will ask you to save, append, etc.
- Press
"Enter"
- Press
Run touch <name-of-file.txt>
Run mv <name-of-file.txt> <folder-name>
By default, sed
only replaces the first occurrence that it finds; however, add a g
to the end of search expression to instruct sed
to replace all occurrences globally:
sed -i 's/{OLD_TERM}/{NEW_TERM}/g' {file}
To run the command in multiple files, just add the names for all of the files as such:
sed -i 's/{OLD_TERM}/{NEW_TERM}/g' {file} {file2} {file3}
Steps to empty your trash using Terminal:
- Open Terminal
- Run the following command:
sudo rm -rf ~/Trash/*
Replace the following in the command below:
- USERNAME
- @Root/To/Network/Drive with the drive you are wanting to mount
- YourLocalShare/YourMountedDrive should be created before you run the command below
sudo mount -t smbfs -o -f=0777,-d=0777 '//USERNAME@Root/To/Network/Drive' ~/YourLocalShare/YourMountedDrive