1. List The files of the current directory
LS lists all files or folders
Ls–l lists so files and their detailed details
LS *file lists the files that begin with file
Ls-l *.doc gives all files that end with. doc in the current directory
2. Copy file CP
CP flt_date201505.apk FLT_DATE201506.APK
Copy a file to flt_date201506.apk
CP Flt_date201405.tsv/etl/app/temp/ff
Copy the file flt_date201405.tsv to the directory/etl/app/temp/ff
Cp/etl/app/temp/abc/flt_date201405.tsv
Copy the FLT_DATE201405.TSV file under directory Etl/app/temp/abc to the current directory and the file name remains the same
CP/ETL/APP/TEMP/ABC/FLT_DATE201405.TSV FLT_DATE201406.TSV
Copy the FLT_DATE201405.TSV file under directory Etl/app/temp/abc to the current directory and change the file name to FLT_DATE201406.TSV
Cp-r/ETL/APP/TEMP/ETL/APP/TEMP/ABC
Copy files and subdirectories under directory/etl/app/temp to directory/ETL/APP/TEMP/ABC
3 . Change the Catalog CD
CD into the current user home directory
CD/Switch to root directory
CD ~ Switch to home directory
CD/TMP switch to Directory/tmp
Cd.. Switch to the top level directory
Cd.. /.. Switch to the top level two directory
CD ~ Switch to the user directory, such as the root user, then switch to/root
4. View the current path
Pwd
5. Move and rename files mv
MV Aflie bfile Renaming afile to bfile
MV Afile/tmp Move the afile under the current directory to the/tmp/directory
6. Delete command RM
Rm-f FLT_DATE201405.TSV
Forcibly delete files flt_date201405.tsv, do not give any hint;
If the file FLT_DATE201405.TSV does not exist, ignore it directly.
Rm-r file name or directory name
Delete files and subdirectories under a file or directory
RM-RF file name or directory
Forcibly delete files and subdirectories under a file or directory
Rm-i file name
Interactive delete files (the system will ask each of them before deleting)
7. Create directory MkDir
mkdir phots to create a directory named photos in the current directory
Mkdir-p This/that/theother Creating a specified nested subdirectory under the current directory
8. View file contents more, less
MORE/ETC/PASSWD viewing the contents of/etc/passwd
Features: Pagination display commands
More file
The more command can also be passed through the pipe character (|) Used with other commands, such as:
PS Ux|more
Ls|more
LESS/ETC/PASSWD viewing the contents of/etc/passwd
9. Search file contents grep
grep Bible/etc/exports finds all rows that contain Bible in file exports
Tail-100/var/log/apache/access.log|grep 404 finds rows that contain "404" in the 100 rows of the Web server log file Access.log
Tail-100/var/log/apache/access.log|grep-v Googlebot in the 100 rows of the Web server log file Access.log to find rows that are not accessed by Google
Grep-v ^#/etc/apache2/httpd.conf Find all non-commented lines in the main Apache configuration file
10. Finding Files Find
Find.-name *.rpm looking for RPM packages in the current directory
Find. | grep page looks up the file name in the current directory and its subdirectories that contains the page files locate traceroute anywhere on the system find file names that contain traceroute files
11. View Process PS
PS [Options]
DESCRIPTION (description): PS command displays some information about the run program options. If you want to display some duplicate information for an option, use the top command instead. Use standard syntax to view each process on the system.
Ps-e
Ps-ef
Ps-ef
ps-ely
12. Process view, kill process, START process
Ps-ef|grep Serverrun viewing a running process
Kill process: End process with kill command: Kill XXX
Freq used: kill-9 324
Linux also provides a killall command that directly uses the name of the process rather than the process identification number, for example: # killall-9 Name
Start process: Go to the directory where the process is executed./process name, for example:
./start.sh Start
13. Package, unpack, tar
TAR-CVF **.tar a.jsp B.java
Make A and B into **.rar tar-xvf **.tar a.jsp B.java
Unpacking the **.tar
displaying file contents
Cat fastload.pl
. Editing a file
New file
----Vim ljt.txt need to create a new file name Ljt.txt
----Click on the keyboard ' I ' key and then write the contents of the file (where you need to input Chinese, choose Unicode (UTF-8))
When you are finished modifying the----, tap keyboard Esc, and then press Shift and:
Enter the contents of the Wq to keep the changes (enter Q when you discard the changes)
Modify an existing file
----The existing file name that the Vim ljt.txt needs to modify Ljt.txt
----Click on the keyboard ' I ' key and then write the contents of the file (where you need to input Chinese, choose Unicode (UTF-8))
When you are finished modifying the----, tap keyboard Esc, and then press Shift and:
Enter the contents of the Wq to keep the changes (enter Q when you discard the changes)
Xshell Linux Common commands