This is a shell cheat sheet to help user
- File's extension is not important in Unix system
- Case MaTTerS
- File Extensions (e.g. .txt .doc .docx) don't matter
- Avoid spaces in filenames
- Files starting with '.' are hidden by default
- Backup files created by some editors will be appended with ~
cat filename
can directly show you the content of your file.cat filename1 filename2 > newfile
can put two files into one filecat filename1 >> newfile
add filename1 into the end of newfilecat filename1 > newfile
replace the content in newfile using filename
sudo su
can make you switch to super user, which has 100% authority.
touch
used when you just want to creat files but not edit them
find . -maxdepth 1 -type f/d -iname "name.txt" -size
is used to find the file"name.txt"
.find . -maxdepth 1 type f/d not -iname "name.txt" -size
is used to find the file is not named"name.txt"
.
grep "keywords" file
is used to find the words in the filegrep -i "keywords" file
is used to find the words in the file but not care about casegrep -n -i "keywords" file
is used to find the words in the file but not care about case and give you the line's number
find . -maxdepth 1 -type f/d -iname "name.txt" -exec grep -i -n "function" {} +