ls
-a show all files, including hidden files
-l display file details in list form
-m Display file size in kb, Mb, Gb
-i View the iNode number of the file <this number is unique in the file system>
touch
touch filename - create a new file
wildcard
* - matches any arbitrary character
? - matches any character
[ ] - matches any character in the set
[ - ] - matches any character in the character range
path
- pwd : view the current path
- cd destination directory: enter the destination directory
- cd ~ / cd : enter the current user home directory
- cd . : represents the current directory
- cd .. : go back to the previous level
- Relative path & absolute path
Directory operations
- mkdir directory name: create a directory (add -p to create a multi-level directory)
- tree directory name: View directory structure
- rm filename: delete file
- rm directory name -r : delete directory (recursively delete)
Copy & Cut (Move)
- cp source file destination file/new name: copy the source file and set the file name
- cp source directory destination directory/new name: Copy the source directory and set the directory name
- mv source file (or directory name) destination directory/new name: move file (directory) and set file name
View file contents
- cat file name: direct all output to the black window
- more filename: split screen to black window
- Output redirection:
>> Append output redirection
- Merge multiple files: cat 1.py 2.py > 3.py
find files
- find path options parameter
--name file characteristics
—— size +- [ bckMG]
- Search file data by features - grep
grep selection feature data filename
Options:
-i ignore case
-n show line numbers
-v negate the condition
Feature data can be regular
^a : line starting with a
B$ : line ending with B