001_linux common Commands ls, mkdir, CD, PWD, RmDir, RM, CP, MV, LN
===================== Body ===============================
XXXXXX directory and File command xxxxxx
1.ls
ls [options] [file or directory]
Options:
-a----show all files, including hidden files
-L----Show details (long means display eg:ls-l)
-d----View Directory properties
-H----User-friendly display of file size (human shows the format that adults can read)
-I----show inode
Add: LL = = Ls-l
------------------Supplemental Linux file Format----------------------------
The file format is 10 bits, such as:-rw-r--r--
1)-File type (the first bit is "-" means a file, "D" means a directory, "L" means a soft connection file is a shortcut)
Note: File permissions are differentiated by the first bit of the file type in Linux
2) rw-r--R-
U owner g All groups O other people
R Read W write X Execute
----------------------------------------------------------------
2.mkdir
mkdir [-p] [directory name]
-P Recursive creation
Command English original: Make directories
eg
mkdir a----Create a directory under the current directory
mkdir b/a----mkdir: Unable to create directory "b/a": No file or directory
mkdir b/a----Correct, successfully created B/A
Description:-P can create a list of directories, without-p to create only one directory
3.cd
CD [catalogue]
Command English original: Change directory
Simplified operation
CD ~----into the current user's home directory
CD----Ibid.
cd-----into last directory
Cd.. ----go to the top level directory
Cd. ----into the current directory
-------------supplemental shortcut keys and Paths-----------------------
CTRL + L----clear screen = = Clear
Relative path: Refer to the current directory to find
such as: [[email protected] ~]$ CD. /usr/local/src
--Absolute path: Starting from the root directory, first-level recursive lookup. In any directory, access to the specified location
such as: [[email protected] ~]$ cd/etc
Table key to complete commands and directories
Press two times the table key to list all directories or commands starting with XXX
-----------------------------------------------
4.pwd
Command English original: Print working directory
Show Current working directory
5.rmdir---Delete directory
rmdir [Catalogue]
Command English original meaning: remove empty directories
Note: Only empty directory can be deleted, the contents of the file can not be deleted---less
6.rm
RM-RF [file or directory]
Catalogue English Original meaning: remove
Options:
-R----Delete Directory
-F----Mandatory
7.CP
CP [Options] [Original file or directory] [target directory]
Command English Original: copy
Options:
-R----Copy Directory
-p----File attribute copying
-D----If the source file is a linked file, copy the link property
-a----equivalent to-PDR
Note: With-A, the copied files and source files are identical; general use Cp-a
--eg:
Cp-a Abc.txt. /b----Copy the Abc.txt file in the current directory intact to the previous level B directory
8.MV----Cut or renamed
MV [original file or directory] [target directory]
Command English Intent: move
->eg:
MV A.. /A----cut the A directory under the current directory to the previous level a directory
MV Abc.txt de.txt----If the original and target files are in the same directory, then the name is renamed, or cut if not in the same directory: Rename the Abc.txt file under the current directory to De.txt
------------------supplement the common directory role of Linux----------------------
/root directory
/bin storing the necessary commands
/boot Store the kernel and the files required for startup
/dev Store device files
/etc Store the configuration file of the system
Home directory for user files, where user data resides in their home directory
/lib storing the necessary runtime libraries
/MNT The temporary mapping file system, we often mount the floppy drive and CD-ROM in the floppy and CDROM subdirectories here.
/proc storing stored process and system Information
/root home directory for super users
/sbin Storage System Management Program
/tmp directory where temporary files are stored
/usr contains applications that do not normally need to be modified, command program files, libraries, manuals, and other documents.
/usr/bin/system command (normal user home)
/usr/sbin/system command (super User root)
/var contains frequently changing files generated by the system
---------------------------------------------------------------------
XXXXXX Link Command xxxxxx
9.ln
ln-s [Original file] [target file]
Command English original meaning: link
Function Description: Generate link file
---option:-S to create a soft link
---------------Supplement------------------
Hard Link Features:
1. Have the same I node and storage block block, can be regarded as the same file
2. Can be identified by the I node
3. Cannot span partitions
4. Cannot use for directory
Soft Link Features
1. Windows-like shortcuts
2. The soft link has its own I node and block blocks, but the data block only save the original file name and I node number, and there is no actual file data
3.lrwxrwxrwx l--Soft Link
(Soft link file permissions are rwxrwxrwx) (depends on the actual file permissions)
4. Modify any file and the other changes
5. Delete the original file, soft link cannot be used
Note: The original file needs to be written as an absolute path when the original and destination files are not in the same directory.
----------------------------------------------------------------------
Summary: Some basic common Linux commands, have a little understanding of Linux, still need to continue to learn, Linux is really good!!!
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Linux common commands 001 ls, mkdir, CD, PWD, RmDir, RM, CP, MV, LN