A LS command
1. [[email protected] ~]# Ls-l listing the details of the file
Total Dosage 4
-RW-------. 1 root root 1695 May 03:22 anaconda-ks.cfg
The first column is permissions, and the second column has several files that use the Inode. The third column is the owner
The fourth column is the owning group. The fifth column is the size of the file, and the sixth column is the time the file was created.
The Seventh column is its file name.
[[email protected] ~]# ls-i anaconda-ks.cfg View the inode of the file
143700 anaconda-ks.cfg
2.[[email protected] ~]# Ls-la list file details and hidden files
3. [[email protected] ~]# LS-LD/List The directory itself, not the file data in the train directory
Ii. Types of files
1.[[email protected] ~]# Ls-la
Total Dosage 44
Dr-xr-x---. 3 root root 4096 June 1 00:46.
Dr-xr-xr-x. Root root 4096 June 1 05:18..
-RW-------. 1 root root 1695 May 03:22 anaconda-ks.cfg
-RW-------. 1 root root 6058 June 2 04:10. bash_history
-rw-r--r--. 1 root root 18 December bash_logout
-rw-r--r--. 1 root root 176 December Bash_profile
-rw-r--r--. 1 root root 176 December BASHRC
-rw-r--r--. 1 root root 100 December CSHRC
DRWX------. 2 root root 4096 June 1 08:43. SSH
-rw-r--r--. 1 root root 129 December TCSHRC
For the above description:
The first column, D, is the directory
First column-is a file (normal file can be viewed with cat)
The first column, C, is a string device
The first column L is a soft link (equivalent to a shortcut)
The first column B is a block device (such as a disc)
The first column S is used for communication (communication between process and process)
Three alias command
Alias aliases
1 [email protected] ~]# which LS use which to see aliases
2 [[email protected] ~]# alias see which commands use aliases
3 [[email protected] ~]# echo $PATH
4 [[email protected] ~]# alias chy= ' Ls-lha ' Create aliases
[[email protected] ~]# alias-p view aliases
[[email protected] ~]# unalias chy de-alias
Add: Alias is only currently in effect, if you want to permanently effect [[email protected] ~]# VI bash_profile Add the alias you want to create and then [[email protected] ~]# source. bash_profile It will be permanent.
Four relative paths
The relative path is not from/(root), relative to the location of a path [[email protected] ~]# ls. Ssh/authorized_keys. Ssh/authorized_keys This is a relative path relative to root [email Protected] ~]# pwd (using PWD to determine the current position)
Five Absolute path
The absolute path begins with/(also known as the root), such as: [[email protected] ~]# Ls/etc/hostname
[Email protected] ~]# LS/ETC/PASSWD
[Email protected] ~]# Ls/usr/share/doc
Six CD command
(1) CD is changedirectory is the command to switch working directory
(2) CD-Indicates the last directory in which it was located
(3) CD ~ User's home directory
(4) CD. Represents a previous level of directory,
seven creating and deleting catalogs Mkdir&rmdir
mkdir is make directory create directory
[[email protected] ~]# mkdir /tmp/chylinux/ creating the Chylinux directory under TMP [[email protected] ~]# ls -ld /tmp/chylinux (see this directory below) drwxr-xr-x 2 root root 4096 6 Month 4 10:30 /tmp/chylinux[[email protected] ~]# date (View time's command) \[[email protected] ~]# mkdir -p /tmp/chylinux/123/456/789/1234567 (mkdir -p is creating a series of directories) [[Email protected] ~]# mkdir -pv /tmp /chylinux/1/2/3 (mkdir -pv v means visual meaning, such as the following) mkdir: created directory "/TMP/CHYLINUX/1" mkdir: Directory created "/TMP/CHYLINUX/1/2" mkdir: created directory "/TMP/CHYLINUX/1/2/3" [[email protected] ~]# mkdir -m 777 chy (-m This is the right to configure the directory at creation time, no need to see the default Umask permissions [[email protected] ~ ]# ls -ld chy (Below is the mkdir -m column) drwxrwxrwx 2 root root 4096 6 month 4 12: 21 chy
rmdir command is used to delete empty directories. When the directory is no longer in use, or if disk space has reached the usage limit, you need to delete the directory where the value is lost. Use the rmdir command to remove one or more empty subdirectories from a directory.
rmdir == remove directory ("Delete ' empty ' directory", only empty directory can be deleted) [[Email protected] ~]# rmdir -pv /tmp/chylinux/123/456/789 (delete directory rm -pv serial Delete and visualize the following example) rmdir: Deleting a directory "/tmp/chylinux/123/456/789" rmdir: deleting directory "/tmp/chylinux/123/456" rmdir: deleting directory "/tmp/ chylinux/123 "rmdir: deleting directory "/tmp/chylinux "rmdir: deleting directory "/tmp/chylinux " failed: directory not empty
[[email protected] ~]# Touch 1.txt Touch is the command to create a file touch is not used to create a new file, creating a file is a special case of the Touch command, touch is used to modify the specified file access and modification time properties, If the specified file does not exist, a new empty file is created and the file's access and modification time is set at the current time.
rm = Remove
[[Email protected] ~]# rm /tmp/chylinux/1/2/3/1.txt (delete file) RM: Delete plain empty file "/tmp/chylinux/ 1/2/3/1.txt "? y[[email protected] ~]# rm /tmp/chylinux/1/2/3/* (* is a wildcard character, matches 0 or more characters) RM: Delete normal empty file " /tmp/chylinux/1/2/3/1.txt "? n[[email protected] ~]# rm -f /tmp/chylinux/1/2/3/* (rm -f is forced to delete, do not need to ask, f =forced ) [[email protected] ~]# history (View history command) [[email protected] ~]# rm -r /tmp/chylinux/1/2/3 (rm -r whether to delete the directory r =recursive ) [[email protected] ~]# rm -rfv /tmp/chylinux/1/2/3 (rm -rfv Delete directory, do not prompt and visualize) [[email protected] ~]# !tree (! is the command to go back to the history command and finally use the tree) [[email protected] ~]# rm -rfv /tmp/chylinux/1/2/3/ (note here is the deletion of the directory if it is a nonexistent directory, such as 3 directory does not exist, at the time of deletion add RM-RFV is without any hint. for example) [[EMAIL PROTECTED] ~]# RM -VR /TMP/CHYLINUX/1/2/3RM:  Unable to delete "/TMP/CHYLINUX/1/2/3": no file or directory
Llinux Basic Command Ⅰ