Common instruction ls display file or directory-l list file details L (list)-a lists all files and directories under the current directory, including Hidden A (all) mkdir Create directory -P Create directory, if no parent directory, create p (parent) CD Switch directory touch create an empty file echo creates a file with content. Cat View file contents CP Copy MV Move or rename rm Delete file-R recursive Delete, can delete subdirectories and files -F Force Delete Find in File system search for a file the number of rows in the WC statistic text, word count, number of characters grep finds a string in a text file rmdir Delete Empty directory tree structure display directory, need to install tree package PWD Display current directory ln Create link file more, less page display text file contents head, t Ail display file header, tail content ctrl+alt+f1 command line full-screen Mode System Administration Command Stat display the details of the specified file, more detailed than LS. Who shows online login user WhoAmI display Show current operation user hostname display host name uname display System Information top dynamic display current consumption of resources up to process information PS display instantaneous process status Ps-auxdu View directory size Du-h/home with units display directory information DF view disk size df-h with unit display disk information ifconfig view network condition Ping Test network connectivity netstat display network status information MAn command will not be used, find men such as: Man lsclear clear screen alias to rename the command such as: Alias showmeit= "Ps-aux", in addition to de-use Una Liax Showmeitkill kills the process, you can first view the process ID with the PS or Top command, and then kill the process with the kill command. Packaging compression Related commands Gzip:bzip2:tar: Packaging compression-C archive file-X compressed file-Z gzip compressed file -J bzip2 Compressed file-V display compression or decompression process V (view)-F Use file name example: Tar-cvf/home/abc.tar/ho ME/ABC is packaged only, uncompressed TAR-ZCVF/HOME/ABC.TAR.GZ/HOME/ABC packaged and compressed with gzip TAR-JCVF/HOME/ABC.TAR.BZ2/HOME/ABC Packaging, and bzip2 compression of course, if you want to decompress, you can replace the above command directly TAR-CVF/TAR-ZCVF/TAR-JCVF "C" in the "X". Shutdown/Restart machine shutdown-r shutdown Restart-h shutdown do not restart now shutdown halt shutdown reboot Restart the Linux pipeline to use the standard output of one command as the standard input for another command. That is, the combination of several commands to use, the latter command in addition to the results of a previous command. Example: Grep-r "Close"/home/* | More in the home directory to find all files, including close files, and paging output. Linux Packages Management dpkg (Debian package) management tool with the. deb suffix of the package name. This approach is suitable for systems that are not networked. For example, install the tree command installation package, first the TreE.deb to the Linux system. Then install it using the command below. sudo dpkg-i tree_1.5.3-1_i386.deb install software sudo dpkg-r tree uninstall software Note: Upload Tree.deb to Lin UX system, there are many ways. Vmwaretool, use of Mount mode, use of WINSCP tools, etc., APT (Advanced Packaging tool) premium software tools. This method is suitable for the system to be able to connect the internet situation. Still take tree For example sudo apt-get install tree installation treesudo Apt-get Remove tree Uninstall Treesudo Apt-get Update software sudo apt-get upgrade convert. rpm files to. deb files. RPM is the software format used by Redhat. cannot be used directly under Ubuntu, so you need to convert it. sudo alien abc.rpm vim uses VIM in three modes: Command mode, insert mode, edit mode. Use ESC or I or: to toggle the mode. Command mode: GG jumps to the top
Shift jumps to the tail
: Q exit: q! Forced exit: Wq Save and exit: Set number Displays line numbers: Set Nonumber hide line number/apache find Apache in document Press N to skip to next, Shift+n previous yy P Copy the line of the cursor and paste H (move left one character ←), J (next line ↓), K (previous line ↑), L (move right one character →) user and user group Management/etc/passwd storage user account/etc/group storage group account/E Tc/shadow Store user account password/etc/gshadow Store user group account password useradd username Userdel user name adduser username groupadd Group name Groupdel group name passwd ROOT to root Set the password SU rootsu-root/etc/profile system environment variable bash_profile user environment variable. BASHRC User environment variable SU user switches users, loads configuration file. Bashrcsu-user switch User, load profile/etc/profile, load bash_profile change file user and user group sudo chown [-r] Owner[:group] {file| Directory} For example: Also take jdk-7u21-linux-i586.tar.gz as an example. belongs to user Hadoop, group Hadoop to switch the users and groups to which this file belongs. You can use commands. sudo chown root:root jdk-7u21-linux-i586.tar.gz file Rights Management three basic rights R read value represented as 4W write value represented as 2X The executable value represented as the 1,jdk-7u21-linux-i586.tar.gz file has a permission of-rw-rw-r---rw-rw-r--altogether 10 characters, divided into four segments. The first character "-" represents a normal file; This location may also have an "L" link; "D" means that the No. 234 character "rw-" of the directory indicates the current owningUser's permissions. Therefore, the value is expressed as 4+2=6 the No. 567 character "rw-" represents the permission of the currently owned group. So a numeric representation of 4+2=6 No. 890 character "r--" represents other user rights. So the value is represented as 2 so the permission to manipulate this file is represented by a value of 662 change permissions sudo chmod [u belongs to user g belongs to group O Other User a All users] [+ Add permissions-reduce permissions] [r W x] Directory name For example: there is a file filename, The permission is "-rw-r----x", the permission value is changed to "-rwxrw-r-x", and is represented by a value of 765sudo chmod u+x g+w o+r filename Above example can be represented by the value sudo chmod 765 filename
20170411linux Common Commands