1. Modify the host name:
# hostname Bigdata-cdh01.ibeifeng.com
# vi/etc/sysconfig/network
2. Turn off the mail feature of the Linux system automatically prompt:
echo "unset mailcheck" >>/etc/profile
3.ssh Password-Free login user home directory:
CD. SSH
Ssh-keygen generate key (-t RSA)
Ssh-copy-id[email protected]:/root/.ssh/
SSH hostname telnet
4. Set the time manually
Date-s 2015-03-12
Date-s 18:23:33
5. Convert the file to the user
Chown-r beifeng:beifeng/opt/cdh-5.3.6/
6. Setting the startup mode
Vi/etc/inittab
# 0-Stop (never set the Initdefault to 0)
# 1-Single user mode
# 2-Multiuser, no NFS (no network)
# 3-Full multi-user mode (command line, is actually text mode)
# 4-No use
# 5-x11 (Xwindow, Windows)
# 6-Restart
7. See which process is consuming the port number:
Netstat-lnp|grep 9999
Netstat Displaying network status information
8.wc
-L Statistic Line
-W Count Count
Ps-ef | Wc-l count the number of rows for all running processes
cat/etc/passwd | grep ' Root ' | Wc-l
Cp-r Copy Directory
Which/whereis ls to find the location of the LS command
--------------------------------------------------------------------------------
DF View disk size df-h with unit display disk information
Du statistics file or directory size
-S (4)-H (4k)
# du-s/etc/to find the total size of the directory
#du-H/etc/Display directory individual file size and directory size with units
--------------------------------------------------------------
grep--Find qualifying lines in the file grep-v culling, reverse selection
# grep ' Root '/etc/passwd
Find--Search for files or directories in the directory that match the criteria
Syntax: the target matching criteria for find lookup
-name Find/home/hainiu-name NIU2
-type D F
# find/etc/-name "*conf*"
--------------------------------------------------------------
VI Vim--edit file
[command-line mode]
DD Delete the line where the cursor is located
3DD Delete the 3 consecutive lines where the cursor is located
P Paste
YY the line where the cursor is copied
4yy consecutive 4 lines where the cursor is copied
G cursor quickly navigates to the last line
GG Cursor quickly navigates to the first line
U Undo Previous Action
[insert mode]
[last line mode]
: Q exit
: q! Force exit
: Wq Save and exit
: Set NU Displays line number
: Set Nonumber hidden line number
: 5 cursor quickly navigates to line 5th
: 1, $s/nologin/888888/g
Replace the nologin of the entire file with 888888
VI command: command-line mode below: Find:/string
Search Down by letter N
Search By letter N
--------------------------------------------------------------
Pipe Symbols |
--Pass the output of the previous command to the latter command processing
--which commands are supported to be placed in the pipeline to conform back (more, head, grep, WC)
cat/etc/passwd | grep ' Root '
cat/etc/passwd | Head-3
Ifconfig | grep ' Inet6 addr: '
Grep-r "Close"/home/* | More
Find all files in the home directory, including close files, and paging output
----------------------------------------------------------
Append \ Overwrite >> >
--append \ Overwrite the output of the previous command to a file
Head-3/etc/passwd >/tmp.pass Coverage
head-3/etc/passwd >>/tmp.pass Append
---------------------------------------------------------------------
Users and user groups
/ETC/PASSWD Some basic information about saving the system user
/etc/group saving information for the system user group
/etc/shadow Store password for user account
/etc/gshadow Password to store user group account
User name: X:uid:gid
Userdel Deleting a user
Useradd adding users
--After creating a user, the system creates a user group with the same name as the user name by default
# Useradd User01
Groupadd Adding user groups
# Groupadd User02
passwd Setting the user password
--echo Echo Character
# echo ' 123456 ' | passwd--stdin User01
# passwd User01
User home directory:
--After the user is created, a directory with the same name as the user name is generated by default in the/home directory.
This directory is called the user's home directory
---------------------------------------------------------------------------
Permissions (ls-a---------ls-la------ll)
# Ls-la
Drwxr-xr-x. 2 test02 test 4096 Nov gnome2
--TEST02 Representative Owner
--test represents the owning group
The first character "-" indicates a normal file, and the "L" link may also appear in this location; "D" means the directory
Group D (RWX) Group II (R-X) third group (R-X)
File type file owner permission bit file has group permission bit other everyone
Modify Permissions command: chmod chown
[Email protected] test02]# chmod u+w,g-r,o+w/srv
Read, Write, execute (4,2,1)
[Email protected] test02]# chmod 734/srv/
Chown
# Chown-r test01:test01/srv/
------------------------------------------------------------------------
Linux compression and decompression tools
tar.gz
--Compression: TAR-ZCVF The package name after compression. Target of tar.gz compression
--Unzip: TAR-ZXVF The package name after compression. tar.gz [-C target directory]
--Example:
# TAR-ZCVF varlog.tar.gz/var/log/
# TAR-ZXF Varlog.tar.gz-c target/
tar.bz2
--Compression: TAR-JCVF The package name after compression. Target of tar.bz2 compression
--Unzip: TAR-JXVF The package name after compression. tar.bz2 [-C target directory]
Zip
--Compression: The target of zip compression
--Decompression: Unzip compression package
rar
--Not supported by default
---------------------------------------------------------------------------
--Installation RPM-IVH
--Uninstall RPM-E
--View Rpm-qa|grep zlib
--See which RPM package the file belongs to
Rpm-qf/etc/ntp.conf
Yum provides/etc/ntp.conf
Yum command:
--List all available (installed) RPM Packages # Yum List
# Yum List | grep httpd-devel
--Install package # yum-y Install
--Uninstall Package # Yum-y Remove
Configuring the Yum Repository
--Common warehouse address mirrors.163.com mirrors.sohu.com
--Warehouse configuration file path/ETC/YUM.REPOS.D
--dns parsing
-----------------------------------------------------------------------------
Mkdir-p Creating a multilevel directory
RmDir Delete Empty Directory
Tree structure display directory, need to install tree package
LN creates a linked file
More, less pagination displays text file contents
Head, tail display file header, tail content
Alias renamed the Command as: Alias showmeit= "Ps-aux", in addition to de-use Unaliax Showmeit
Top View System Overall resources (Windows Task Manager)
Free to view memory usage
netstat [-anltup] viewing port conditions
Netstat-an
Netstat-tlnp
PS Viewing process
Ps-ef View all processes, standard format display
PS AUXF display transient process status in BSD format
Vmstat Iostat mpstat SAR View instructions for CPU performance
Stat Displays details of the specified file, more detailed than LS
Who shows online login
Top dynamic display currently consumes the most resources process information
Linux basic commands