I. Management of the file system
Tips: Use the TAB key when entering commands to complete
LS View directory information (LS/)
Ls-l equivalent to LL
PWD View the path that is currently in place
CD switch directory (CD/), switch to user home directory if without parameters ~
mkdir Creating a Folder
RmDir Delete Empty folders (only empty folders can be deleted)
Rm-r/a/b (Delete non-empty folders)
Create a file
Touch A.avi Create an empty file
VI blabla.txt Edit a file with a text editor and save
echo "Angelababy,zhen de hen Xihuan ni" > qingshu.txt put the left output in the file on the right.
deleting files
RM filename (rm-r Delete folder Rm-rf forcibly delete files or folders)
Move file Modify file name
MV A/wenjian1.txt B/file1.txt (also modified file name when moving files)
Copy files
CP Srcfile DestFile
View File Contents
Cat Wodeqingshu.txt
More Wodeqingshu.txt can be paged to see
Less wodeqingshu.txt not only can be paged, but also easy to search, rewind and other operations
tail-10 Wodeqingshu.txt View 10 lines at the end of a file
Program-typed logs have an extraordinary debug significance in production practice
Tail-f User.log Real-time refresh displays the end of the file
head-20 wodeqingshu.txt View the file header 20 lines
II. Rights Management
Drwxrwxr-x
Modify Permissions
chmod u+rwx file Adds or cancels the permissions of the owning user for file
(U represents a member user of the owning group, O on behalf of other users)
chmod 567 file with a number can also represent permissions
5---> 101---> R-x
Modify the owner of the file owners
Chown Hadoop:hadoop file changes the owner of the file to a Hadoop user and the owning group to the Hadoop group
The permissions of the parent directory are also restricted to the operation of this level file or folder.
Third, user management
Add user
Useradd itcast0830
You must set a password to log in properly passwd itcast0830
Delete User
Userdel Yun12
Userdel-r itcast-----Delete the user's home directory while deleting the user
Modify User Properties
Usermod-l b A will change the login name to B
Usermod-g Hadoop itcast0830 Change itcast0830 Group to Hadoop Group
Usermod-g hadoop,root itcast0830 Add two groups to itcast0830 Hadoop,root
usermod-d/home/itcast itcast0830 Change itcast0830 's home directory to/home/itcast
(To create the Itcast directory in advance and copy the environment variable file)
----* * * *----Modify user's password
passwd itcast0830
To add a user group
Groupadd Beauties
Delete a user group
Groupdel Beauties
Modify User Group Properties
Groupmod
View the current login status
WhoAmI
View the current group of genera
Groups
Iv. common system management (usually involves the modification, must use the root authority)
****
It is easy not to use Su to switch to root identity
Commands that ordinary users use sudo to perform root permissions
For example, add a Hadoop user to the sudoers file
Root all= (All) all
Hadoop all= (All) all
Disk space Information View
Df-h Viewing disk space status information
Du-sh * View the total size of all subdirectories and files in the current directory
Process Information View
Free View Memory usage
Top View system process information for real-time refreshes
Ps-ef View snapshot of process information for the current instant in the system
Ps-ef | grep myshell.sh Search for Myshell process information
Kill-9 PID Kill Process (-9 means forced kill)
V. File archive Compression (1: Package-archive; 2: Compress)
1. Archive
TAR-CVF Testdir.tar testdir/
2. Compression
Gzip Testdir.tar
gzip file
bZIP file
TAR-CZVF testdir.tar.gz testdir/
TAR-XZVF testdir.tar.gz extract to current directory
TAR-ZXVF testdir.tar.gz-c downloads/extracted to the specified Downloads directory
VI. Network Management
Modifying the configuration of IP addresses
Vi/etc/sysconfig/network-scripts/ifcfg-eth0 Modify the configuration file to change the IP address
or use the Setup command to modify it with a pseudo-graphical interface with hints
View IP Address
Ifconfig
Modify Host Name
Vi/etc/sysconfig/network Modifying the hostname configuration item
To take effect immediately, you can execute the instruction hostname nidezhujiming
Hostname=yun12-01
Managing Host Names---IP address mappings for the intranet
Vi/etc/hosts
192.168.2.250 yun12-01
Restart Network Service
Root Privileges Service Network restart
Turn off firewall Services service iptables stop
Turn off firewall auto-start chkconfig iptables off
To modify the system's default boot level
Vi/etc/inittab
# 0-halt (do not set Initdefault to this)
# 1-single User mode
# 2-multiuser, without NFS (the same as 3, if you don't have networking)
# 3-full Multiuser mode
# 4-unused
# 5-x11
# 6-reboot (do not set Initdefault to this)
#
Id:3:initdefault:
~
Start the full-featured character interface with Level 3
View information about the current process connection network
Netstat-nltp
V. Common TOOLS directive
WC Statistical text information (number of lines, number of words, characters)
Date and time when the system was viewed or modified
Echo output string or value of variable
The most common text editor in the VI Linux system
Vi. Software Installation in Linux
Jdk
Unzip the installation package to your installation path
Then modify the environment variables sudo vi/etc/profile
Then source/etc/profile to take effect.
Tomcat
Eclipse
Mysql
Redhat Company's RPM approach to package management is also a very common package Manager
Rpm-qa | grep MySQL
sudo rpm-e mysql-libs-5.1.66-2.el6_3.i686--nodeps
sudo rpm-ivh mysql-server-5.1.73-1.glibc23.i386.rpm
Recently learned Linux common commands.