A brief introduction to Linux and the introduction of common commands
This note takes the Ubuntu system as an example
Ubuntu system installation Self-Baidu, or reference http://www.cnblogs.com/CoderJYF/p/6091068.html
Self-installing
Introduction to Linux and Ubuntu installationLinux, free open source, multi-user multitasking system. Linux is based on multiple versions of the derivative. RedHat, Ubuntu, debian install VMware or VirtualBox virtual machines. Specific installation procedures, to find Baidu. Install Ubuntu again. Specific installation steps to find Baidu
Common DirectivesLS show file or directory -l list file details L (list) &NB Sp -a list all files and directories in the current directory, including Hidden A (all) mkdir Create directory & Nbsp;-p Create directory, if no parent directory, create p (parent) CD to switch directories Touch Create an empty file echo to create a file with content. Cat View file content cp copy MV & nbsp Move or rename rm Delete files &nbs P;-r Recursive Delete, delete subdirectories and files -f &NBS p; Force delete find File system search for a file WC Statistics text row count, Word count, number of characters grep &NBSp Find a string in a text file rmdir Delete empty directory tree &N Bsp Tree structure display directory, need to install tree package pwd Show current directory ln & nbsp Create link file more, less pagination display text file contents head, tail Display file header, tail content ctrl+alt+f1 command line full screen mode
System Administration Commands Stat Show details of specified files, more details than LS, who &NBSP ; Show online login user whoami Show current operation user hostname show hostname uname &NBS P Display System Information top Dynamic display current cost of resources Max process information PS &NB Sp Show instant 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 &NBS P View network conditions ping Test network connectivity netstat & nbsp Show network status information man command It's not going to work, find men like: Guy Lsclear &NBS P Clear screen alias To rename commands such as: Alias showmeit= "Ps-aux", another solution In addition to usingUnaliax Showmeitkill kill 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 commandsGzip: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/HOME/ABC Packaged only, uncompressed TAR-ZCVF/HOME/ABC.TAR.GZ/HOME/ABC, packaged with gzip compression tar-jcvf/home/abc.tar.bz2/home/abc, and BZIP2 compression Of course, if you want to decompress, directly replace the above command TAR-CVF/TAR-ZCVF/TAR-JCVF "C" in the "X".
shut down/ Restart the machineShutdown-r shutdown Restart-h shutdown does not restart now shutdown halt shutdown reboot restart
Linux PipelinesUse 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 Package ManagementDpkg (Debian package) management tool with a. deb suffix. This approach is suitable for systems that are not networked. For example, install the tree command installation package, first upload 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 UseVim three modes: Command mode, insert mode, edit mode. Use ESC or I or: to toggle the mode. Command mode:: 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/etc/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 set password su rootsu-root/etc/profile system environment variable bash_profile user environment variable. BASHRC User environment variable SU user switches the user, loads the configuration file. Bashrcsu-user switch User, load profile/etc/profile, load bash_profile change file Users and user groups 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 ManagementThree basic rights R read value is represented as 4W write numeric value represented as 2X executable value represented as 1, jdk-7u21-linux-i586.tar.gz file has permission of-rw- Rw-r---rw-rw-r--altogether 10 characters, divided into four segments. The first character "-" indicates a normal file; This location may also have an "L" link; "D" indicates that the No. 234 character of the directory "rw-" represents the permissions of the currently owned user. 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
A brief introduction to Linux and the introduction of common commands