Learn Linux common commands (recommended) _linux shell

Source: Internet
Author: User
Tags chmod memory usage parent directory iptables

I. Management of the Document System

Tips: When you enter a command, you need to use the TAB key 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/) and switch to user home directory without parameters ~

mkdir Create a folder

RmDir Delete Empty folders (only empty folders can be deleted)

Rm-r/a/b (Delete non-empty folder)

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 Force delete file or folder)

Move file Modify file name

MV A/wenjian1.txt B/file1.txt (while moving the file also modifies the filename)

Copy files

CP Srcfile DestFile

View File Contents

Cat Wodeqingshu.txt

More wodeqingshu.txt can be divided into pages to see

Less wodeqingshu.txt not only can be divided into pages, but also can be easily searched, inverted and other operations

tail-10 Wodeqingshu.txt View 10 lines of the tail of the file

The log produced by the program has the special meaning of debug in production practice

Tail-f User.log Real-time refresh displays the tail of the file

head-20 wodeqingshu.txt View file's head 20 lines

Second, authority management

Drwxrwxr-x

Modify Permissions

chmod u+rwx file Adds or cancels the permissions of the owning user for file

(U on behalf of the user O on behalf of other user G on behalf of the group member users)

chmod 567 file with numbers can also represent permissions

5--->---> R-x

Modify the owner of the file owners owner

Chown hadoop:hadoop file to convert owner of file to Hadoop user, group to Hadoop Group

Permissions on the parent directory are also constrained to the operation of this level of files or folders

Third, user management

Add user

Useradd itcast0830

You must set a password to log on normally passwd itcast0830

Delete User

Userdel Yun12

Userdel-r Itcast Deletes a user's home directory while deleting a user-----

Modify User Properties

Usermod-l b A To change the landing name of A to B

Usermod-g Hadoop itcast0830 To change the itcast0830 group to a Hadoop group

Usermod-g Hadoop,root itcast0830 adds two groups to itcast0830 Hadoop,root

usermod-d/home/itcast itcast0830 convert itcast0830 home directory to/home/itcast
(To create the Itcast directory beforehand, and to copy the environment variable file)

----* * * *----Modify user's password

passwd itcast0830

Add User Group
G

Roupadd Beauties

Delete a user group

Groupdel Beauties

Modify User Group Properties

Groupmod

View the status of the current login

WhoAmI

View the groups that are currently in the genus

Groups

Iv. common system Management (all involved to modify, we must use root permissions)

****

It is easy not to use Su to switch to root identity

command for normal users to perform root permissions using sudo

For example, add a Hadoop user to the sudoers file

Root all= (All)

Hadoop all= (All)

Disk space Information View

Df-h View disk space status information

Du-sh * View total size of all subdirectories and files under 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 in the system at the moment

Ps-ef | grep myshell.sh Search for Myshell process information

Kill-9 PID Kill Process (-9 for forced kill)

V. File archive Compression (1: Pack--archive; 2: Compress)

1, archiving

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

Modify the configuration of an IP address

Vi/etc/sysconfig/network-scripts/ifcfg-eth0 Modify the profile to change the IP address

or use the Setup command to modify it with a hint pseudo graphical interface

View IP Address

Ifconfig

Modify Host Name

Vi/etc/sysconfig/network Modify the Hostname configuration entry
To take effect immediately, you can execute instructions hostname nidezhujiming

Hostname=yun12-01

IP address mapping of host name---management intranet

Vi/etc/hosts

192.168.2.250 yun12-01

Restart Network Services

Root permissions under Service network restart
Turn off Firewall service iptables stop
Turn off firewall auto start chkconfig iptables off

To modify the default boot level for a system

Vi/etc/inittab

# 0-halt (Don't 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 (Don't set Initdefault to this)
#
Id:3:initdefault:
~

Start a fully functional character interface with level 3

View information for the current process connection network

Netstat-nltp

V. Common TOOL Instructions

WC statistic Text information (number of lines, number of words, number of characters)

Date and time to view or modify the system

Echo output string or value of variable

VI Linux System in the most common text editor

Vi. Software Installation in Linux

Jdk

Unzip the installation package to your installation path

Then modify the environment variable sudo vi/etc/profile

And then Source/etc/profile comes into force.

Tomcat

Eclipse

Mysql

Redhat Company's RPM approach 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

The above is a small set to introduce the study of Linux commonly used commands (recommended), I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.