Ls display file or directory
-Me? List file details l (list)
-a? Lists all files and directories in the current directory, including the hidden A (All).
Mkdir create directory
-p? Create a directory, or if there is no parent directory, create P (parent directory).
cd? Switch directories
Touch? Create an empty file
Echo creates a file with content.
Cat? View file contents
Cp copy
mv? Move or rename
rm? delete a file
-r recursive deletion, you can delete subdirectories and files.
-f forced deletion
Found it? Searching for files in the file system
Wc counts the number of lines, words and characters in the text.
Grep looks for a string in a text file.
rmdir? Delete empty directory
The tree-tree structure displays the directory, and the tree package needs to be installed.
pwd? Display the current directory
Where is it? Create a linked file
More, less? Pagination display text file content
The header and trailer show the contents of the header and trailer of the file.
ctrl+alt+F 1? Command line full screen mode
2. System management command
Statistics? Displays the details of the specified file, which is more detailed than ls.
Who is it? Show online logged-in users
whoami? Displays the current operating user.
Host name? Show host name
Ume? Display system information
Top dynamically displays the process information that currently consumes the most resources.
ps? Display real-time process status ps -aux
Du? View directory size du -h /home and device display directory information.
df? Use the device to display the disk information and view the disk size df -h h.
ifconfig? Check the network situation
Ping to test network connectivity
netstat? Display network status information
Men's command doesn't work. What do you want with men? Such as: man ls
Is that clear? cls
Alias? Rename the command, such as alias showmeit="ps -aux ",and disable unaliax showmeit.
Kill terminates a process. You can use ps or top command to check the id of the process first, and then use kill command to kill the process.
3. Pack and compress related commands
Tar: packaging and compression
-c? archive file
-x? compressed files
-z? Gzip compressed file
-j? Bzip2 compressed file
-v? Show compression or decompression process v (view)
-f? Use file name
Example:
tar -cvf /home/abc.tar /home/abc? Only package, not compress.
Tar-zcvf/home/abc.tar.gz/home/ABC is packed and compressed with gzip.
tar-jcvf/home/ABC . tar . bz2/home/ABC? Pack and compress with bzip2.
Of course, if you want to decompress, just replace the above command? tar -cvf? /tar-zcff? Just replace "c" with "x" in /tar -jcvf.
3. Shut down/restart the machine
switch an electrical device off
-r shutdown and restart
-h Shut down and do not restart.
Now? Turn it off at once.
Stop. Turn off the appliances
Restart? restart
4.Linux pipeline
Use the standard output of one command as the standard input of another command. That is, several commands are used in combination, and the latter command divides the result of the previous command.
For example: grep -r "close" /home/* | More? Search all files in the home directory, including the files of close, and output them in pages.
5.Linux software package management
dpkg? (Debian package) management tool, the suffix of the package name is. Debenture corporate bonds This method is suitable for the case that the system cannot be networked.
For example, install the installation package of the tree command, and first transfer the tree.deb to the Linux system. Then use the following command to install.
Sudo dpkg-i tree _1.5.3-1_ i386.deb to install the software.
Sudo dpkg -r tree uninstall software?
Note: There are many ways to transplant tree.deb to Linux system. VMwareTool, using mount mode; Use winSCP tools, etc.
APT (advanced packaging tool) advanced software tool. This method is suitable for the case that the system can connect to the Internet.
Let's take trees as an example.
Sudo apt-get installation tree installation tree
Sudo apt-get remove tree? Unloading tree
Sudo apt-get update update software
Sudo apt-get upgrade?
6. conversion. Rpm file to. Deb file.
. Rpm is a software format used by RedHat. It can't be used directly under Ubuntu and needs to be converted.
sudo alien abc.rpm
7.vim usage
Vim has three modes: command mode, insert mode and edit mode. Use ESC or I or: to switch modes.
In command mode:
:q? give up
:q! Force-quit
:wq? Save and exit
: The set number shows the line number.
: Set the number? Hide line number
/apache Find apache in the document Press n to skip to the next one, and press shift+n to skip to the previous one.
yyp? Copy the line where the cursor is located and paste it.
H (shift one character to the left), J (next line ↓), K (previous line =), L (shift one character to the right →)
8. User and user group management
/etc/passwd stores user accounts.
/etc/group? Storage group account number
/etc/shadow stores the password of the user account.
/etc/gshadow? Store passwords for user group accounts.
Useradd user name
Userdel user name
Add user name
Group add group name
Groupdel group name
Passwd root sets the password for the root user.
/etc/profile system environment variable
Bash_profile user environment variable
. Bashar? User environment variable
Su users? Switch users and load configuration files. Bashar.
Su-user switches users, loads the configuration file /etc/profile and loads bash_profile.
Change users and user groups of files
sudo chown[-R]owner[:group]{ File | Directory }
Take JDK-7U21-Linux-i586.tar.gz as an example. Belong to user hadoop, group hadoop
Switch users and groups to which the file belongs. You can use the command.
Sudochow root: root? JDK-7u 2 1-Linux-i586 . tar . gz
Extended data Linux is a Unix-like operating system that is used and disseminated for free. It is a multi-user, multi-task, multi-thread and multi-CPU operating system based on POSIX and UNIX. It can run major UNIX tools, applications and network protocols. It supports 32-bit and 64-bit hardware. Linux inherits the network-centric design idea of Unix and is a multi-user network operating system with stable performance.
UNIX operating system (Eunice) is a powerful multi-user and multi-task operating system, which supports a variety of processor architectures. According to the classification of operating system, it belongs to time-sharing operating system. It was first invented by ken Thompson, dennis ritchie and Douglas mcilroy at AT&T in 1969. T's bell laboratory development. At present, its trademark right belongs to the International Open Standards Organization. Only UNIX systems that conform to a single UNIX specification can use the name UNIX, otherwise it can only be called UNIX (UNIX-like).