1.ls Directory Enumeration (dir)
Generally we write this:
Linux Code Collection Code
Ls
Enumerating all the files in the current directory, if there are many files, it is very complicated. We can add keywords, for example we want to see all the files that contain XML.
Linux Code Collection Code
LS *xml*
If this time, we want to see the owner information of these files can be written like this:
Linux Code Collection Code
Ls-la
2.CD Directory Switching
As with other directory switching commands, there is no difference.
Linux Code Collection Code
CD A
Switch to the A directory.
3.chown change the owner of a file (folder)
Above through LS we see a bunch of files, there may be files we can not operate, this time requires the root account to execute the chown command to change the file belongs to, you can write:
Linux Code Collection Code
Chown Boss.boss *
This operation is to give all the files in the current directory to the boss user and the boss Group user all rights. So the files (folders) under the Sub-folder need to be modified how to do it? Perform
Linux Code Collection Code
Chown-r Boss.boss *
4.mkdir Creating a Directory
This command is simple enough to perform
Linux Code Collection Code
mkdir x
We have built an X directory under the current directory.
5.cat File View
We can view the contents of the file via the cat command and execute
Linux Code Collection Code
Cat A.xml
We can view the contents of this file, of course, in textual form.
6.tail File View (can track files)
If this command does not add parameters, and Cat no difference, the final thing is that he can track the contents of the file, we often use it to monitor the log, such as
Linux Code Collection Code
Tail-f Javaeye.log
When the Javaeye.log file grows, we can capture this change in the console, and if the log file changes quickly it looks like a scene in The matrix (black-green, no-stop brush!). )。
7.tar file compression
Compression decompression, which is the basic operation of the deployment effort.
Linux Code Collection Code
TAR-ZVCF java.tar.gz Java
All files containing subfolders under the Java directory are compressed into java.tar.gz files.
In turn, the unzip execution
Linux Code Collection Code
TAR-XZVF java.tar.gz
8.RM Delete
Tossing so much, generating a heap of junk files. Clean up quickly, hehe!
Linux Code Collection Code
RM *
Oh, my God! It's horrible! Fortunately did not carry out!!! Brothers, remember that you must not use this command when you execute the DELETE command!!! If you are a super administrator, it will be possible to delete all the files, the system will be paralyzed in the moment of reboot!!! It's a good idea to specify a filename or path name to avoid all deletions, which is suicide! Oops, the directory can not be deleted, there are sub-files can not be deleted what to do?
Linux Code Collection Code
Rm-r XML
This allows you to completely delete the XML directory.
9.SU Super User command
Just doing chown, we need to switch to the superuser, the root user, what to do? Perform
Linux Code Collection Code
Su
Follow the prompts to enter the root user password and easily switch to Superuser. This account is not recommended for non-essential situations!
10.vim (vi) text editing
This is a bit more complicated, so let's just say that simple operations can meet our needs. Writing a file is nothing more than writing something in. VI, VIM use up, feel or vim comfortable a bit. Edit a file,
Linux Code Collection Code
Vim A.txt
Now that the file is open, but you cannot edit it, type I. Tip INSERT, insert State, we can insert text. Finished, CTRL + C end the input status, type: W, save does not exit, type: Wq, save exit. What if you don't save a forced exit? Type: q!. Of course, if you just come up and look at the content to exit directly, then type: Q. If you want to find a keyword in the file, you can type/x. /means search, and x is the keyword.
11.CP file copy
This command is an abbreviation for the copy word, such as we want to do a file/directory backup, you can use this command:
Linux Code Collection Code
CP A.txt A.txt.bak
In this way, the backup file A.txt.bak is obtained from the A.txt file.
If you want to copy a directory, you need to use the parameter-r:
Linux Code Collection Code
Cp-r a B
This allows you to copy the A directory into the B directory.
12.MV file Clipping
This command is an abbreviation for the move word that can be used to cut/rename files and directories.
This command was originally intended to cut the operation, but from its point of view, it is suitable for the name of the duplicate!
Linux Code Collection Code
MV A C
A is a file, it can be a directory, the above operation, a file/directory becomes a c file/directory!
13.mount Device Mount
Linux Code Collection Code
Mkdir/media/cdrom
Mount-t Iso9660/dev/cdrom/media/cdrom
-T iso9660 Optional
14.umount Device Uninstall
Linux Code Collection Code
Umount/media/cdrom
15.ENV Environment variables
- Related articles recommended:
- Linux User management commands (Useradd, adduser)
- What are the Linux restart commands? Linux Restart command Daquan
- Examples of Linux finger command usage
- This article from: Hobby Linux Technology Network
- This article link: http://www.ahlinux.com/start/cmd/9597.html
Linux command finishing-basic operations