Basic commands under Linux
ls : List
pwd : Print work directory (printing working directories)
CD : Change directory (switch directory)
Example: CD-Back to last directory
Example: cd ~ Back to the current user directory
Example: CD. /: Back to the top level directory of the current directory
Clear : Clear screen
mkdir : New directory
rmdir : Delete Empty directory
Cat : View file contents
Touch : Create a file
RM : Delete
cp : Copy
file : View Properties
MV : Move, rename
echo : Writing content to a file
Example: Echo Hello > A writes "Hello" content to a file (overwriting the previous content in a file)
echo OK >> A append write "OK" to a file (not overwritten)
Second, Linux under the Ten classic commands
tar : (Xx.tar, xx.tar.gz)
Package Example: TAR-CF H.tar OK to package the files under the OK directory as H.tar
Example: TAR-CVF h2.tar OK to package files under the OK directory as H2.tar plus v parameter to see package details
Unpacking Example: TAR-XVF H2.tar the H2.tar package to unpack the x parameter as the unpacking parameter
Package and compress (current directory) Example: TAR-CZVF h3.tar.gz OK to package and compress the files in the OK directory to H3.tar plus the z parameter for packaging
Unpack and decompress (current directory) Example: TAR-XZVF h3.tar.gz Unpack the h3.tar.gz package x parameter as the unpacking parameter
Unpack and unzip (other directories) Example: TAR-XZVF h3.tar.gz-c/Unpack the h3.tar.gz package into the "/" directory C (uppercase) parameter to change the path
Multiple directory Packaging Compression example: TAR-CZVF h4.tgz OK Test test2 package The file under the OK directory and compress it to h4.tar with the Z parameter as the package
Note: Suffixes can be customized, not necessarily xx.tar.gz or abbreviated to XX.TGZ but it is best to use defined definitions
?
chmod(change mode):
#ls-L (can be simply written as "ll")
-rw-r--r--1 root root 03-16 14:30 a
-rw-r--r--1 root root 10240 03-16 14:38 H2.tar
Drwxr-xr-x 2 root root 4096 03-16 14:28 OK
Drwxr-xr-x 2 root root 4096 03-16 14:28 test
?
Interpretation:-rw-r--r--
-Type ("-" stands for file, "D" stands for directory)
rw-the creator's permission to manipulate the file ("R" Readable, "w" Writable, "x" executable)
r--user permissions to the file ("R" Readable, "w" Writable, "x" executable) for the same group as the creator
r--user permissions for files with different groups of creators ("R" Readable, "w" Writable, "x" executable)
?
RWX rwx rwx Maximum Privileges
In binary notation: 111 111 111
Represented by numbers: 777 each set of permission levels can be represented by an octal number
---------minimum permissions
Represented by numbers: 000
?
chmod usage
Example 1:-rw-r--r--1 root root 03-16 14:30 a
#chmod U+x A gives the creator "executable" permission to file a
???? Note: U (user): Represents creator G (group): Representative Group O (Other): Represents different Group A (all): On behalf of all users
???? -rwxr--r--1 root root 03-16 14:30 a
Example 2: #chmod a=x A gives all users only executable permissions
---x--x--x 1 root root 03-16 14:30 a
Example 3: #chmod 777 A gives all users the highest privileges
-rwxrwxrwx 1 root root 03-16 14:30 a
Summarize
chmod u/g/o/a (+/-/=) r/w/x FileName
chmod three octal numbers filename
?
Not to be continued ...
Basic Linux Knowledge