Linux Common Commands--(vi)

Source: Internet
Author: User
Tags bz2 clear screen disk usage

TAB: Auto-complete

CTRL + C Close

1. Logout, shutdown, restart

-Logout: Logout: Logout, exit (just exit the account)

-Shutdown: (need to be root or be granted permission by root)

Shutdown-h time

-H: Shutdown

Time

1. Now: Right away

2.12.30: Specify a specific time

3.3: A few minutes later

Sudo:superuser do: The command is executed by the super user

To configure the sudo command: which users are authorized to perform which commands

Configuration of sudo by super user

/etc/sudoers

sudo shutdown-h now current account: Itcast

-Restart:

Shutdown-r time

-r:restart

2.linux Basic command: File Operations Command

1. LS: View directory contents

-L: View more information

-A: View all Files (hidden)

Man:manual: Manual, Help, assistance commands, like Windows Help

Command: Man ls

2. mkdir: Creating a Directory

Desktop:

-Java

-JEE:aa.txt Bb.txt

-Android

3. CD Switch Directory

-CD. Remember to add a space

-CD./java into subdirectories of the current directory

-CD. /xxx into subdirectories of the previous level directory

4. Touch: Create a blank plain file

Touch Aa.txt

    1. Echo: Redirect the content to the specified file, open with none, create

echo "Content" >bb.txt

6. Cat, more: View file contents

-Cat: View file contents

-MORE: Paging to view the contents of the file, press SPACEBAR to change pages

More 111.txt press SPACEBAR to continue paging

More , less pagination displays text file contents
1: Paging is very long when viewing the configuration file
2:more (one page, one page turn)
1: SPACEBAR to PAGE DOWN
2:enter key scroll down one line
3::F Displays the file name and the current number of rows
4:q leave more
5:b, turn back.
3:less (one page, one page turn)
1: Space down one page
2:pagedown down one page
3:pageup up one page
4:q leave
16:head,tail displays the beginning and end of the file, respectively

7. CP, MV, RM

-CP: Copy

CP Bj.txt./java/jee

-MV: Cut, rename

1. Cut: MV Aa.txt. /android/

2. Rename: If the clipped file is stored in the same directory, it is renamed

MV Bb.txt Cc.txt

-RM: Delete files or folders

-F: If the file to be deleted does not exist, do not prompt

-I: Prompt before deletion, not delete by default, to delete, enter Y

-D: Delete empty directory

-R: Recursive delete

8. Wc:word Count: Count characters

154 233 3418

-154: Number of rows

-233: Number of words

-3418: Number of characters

Command: WC bj.txt

9. LN: Creating a Connection File

-The default is to create a hard connection, like copy, but two files are synchronized

Command: Ln./java/android/aa.txt AAA

-S: Creates a soft connection that changes to a point

PWD: View the absolute path to the current directory

11. Pipeline Command |

Command: Ls-la | Wc

12. Redirect (add text content)

->: Overlay mode

Command: Echo "WW" >aaa

->>: Append mode

Command: Echo "WW" >>aaa

passwd: Set password, ubuntu default root account is not turned on, as long as the root password can be set to open

sudo passwd root

SU Switch Directory

Su Root

The root user does not need a password to switch to another account

3.linux system Commands

1.stat: View File details

Stat Bj.txt

2.who and WhoAmI

Who: View online users

WHOAMI: View your current users

3.hostname: Display host name

Hostname

4.uname: Display System Information

-A: Displays complete system Information

5.top: Displays the current time-consuming information, refreshed every 3 seconds

Cltr+c Interrupt

6.ps: Displays a snapshot of the current process

-Axu

7.DU: Show file size information

8.DF: Disk usage disks free

9.ifconfig : View or configure NIC information, like Windows ipconfig

ipv4:32 bit 2-32 IPv6 128 bits is IPv4 2-96 Times Square

Set the virtual machine IP address:

1. Set up VMware's connection mode

-The IP address of the shared host is not found in the Network Neighborhood

-Bridge mode, you need to set the IP separately, you can find it in the Network Neighborhood

2. Graphical interface setting IP address

Edit Connection--"ipv4--" manual (manually set)--"Add (IP address, subnet mask)

3. Set the IP address in the command mode

Statically set IP:

sudo ifconfig eth0 192.168.15.122 netmask 255.255.255.0

10.ping test and target host connection

11.clear: Clear Screen Windows:cls

12.man: Help command

Man command

13.kill: Kill Process

Kill PID

14.netstat: Network Connection details

Useradd.

-View user Information

sudo cat/etc/passwd

Itcast:x:1000:1000:ubuntua,,,:/home/itcast:/bin/bash

-Itcast: User name

-X: Password: Encrypted, password stored in/etc/shadow

-1000: Account ID, userId

-1000: Group ID, Team ID

-Ubuntua,,,: Account description

-/home/itcast: The default location of the file to which the account is stored ~

-/bin/bash: How the user's shell script is parsed, SH, bash, Rbash

-Create User

sudo useradd lijun-d/home/lijun-s/bin/bash

-D: Specify the user's home path

-S: Shell parsing method for this user

Steps:

1. Create a/home/lijun directory

2. Execute useradd command

3. Set the password with passwd

4. Su Switch User

specific user and user group Management reference: http://www.runoob.com/linux/linux-user-manage.html

4. Packaging, compressing files

Windows:zip, rar

Linux:gz, Bzip,zip

1.tar: Package, unpacking command

TAR-CXZJVF < packaged files > < directories to package >

-C: An archive file created, that is, a packaged folder

-X: Unpacking

-Z: Compressed in gzip format, default compression multiplier 6 times times (0-9)

-J: Compressed in bzip2 format

-V: Displays file information for package or unpacking

-F: Immediately following an archive file

-Packaging files

TAR-CVF News.tar./java Summary

-Unpacking files

TAR-XVF News.tar

2.gzip, bzip2 compression and decompression

1. zip file ( name suffix automatically added. gz, size changed to original 1/6)

Gzip News.tar

2. Extracting files

Gzip-d news.tar.gz

-D: Unzip

3. Packaging and compression

-Packaging and compression

TAR-CZVF news.tar.gz./java

-Unpacking and pressure reduction

TAR-XZVF news.tar.gz

4. Packaging, compressing files (2)

1:tar
1: Packing
1:TAR-CVF Familya.tar Familya (TAR-CVF save path/Package name package directory)
2: Unpacking
1:tar-xvf/home/itcast/familya.tar
2:gzip Command
Gzip Compress (unzip) file, zip file suffix to gz
1: Compression
1: Compress all files in the Familya directory under the/home/itcast directory into. gz files
1:gzip can only compress files, directories (folders cannot be processed), you need to use tar to package folders
1:gzip Familya.tar for compression

2: View Compressed Files
1:gzip-l familyA.tar.gz View Compression Pack details
1:compressed size after compression
2:uncompressed Original Size
3:ratio Compression ratio
4:uncompressed_name Original file name
3: Unzip
1:gzip-d familyA.tar.gz Display file name and compression ratio
4: Compression ratio
1: High compression (slightly slower)
Gzip-9 Familya.tar High Compression ratio
Gzip-l familyA.tar.gz
2: Low compression ratio (FAST)
Gzip-d familyA.tar.gz (Unzip)
Gzip-1 Familya.tar Low Compression ratio
Gzip-l familyA.tar.gz
3: Default is 6

3:bzip2 Command
Bzip2 Compress (unzip) the file or directory, the compressed file suffix is bz2
1: Compression
1: Compress all files in the Familya directory under the/home/itcast directory into. bz2 files
1:bzip2-z Familya.tar compression required plus parameter-Z
2: Unzip
1:bzip2-d familyA.tar.bz2
4:tar command compression and decompression
1: Package All files in the entire/home/itcast/familya directory into/home/itcast/familya.tar
1: Package only, do not compress
1:TAR-CVF Familya.tar Familya
2: After packaging, compress with gzip
1:TAR-ZCVF familyA.tar.gz Familya
Split Package
sudo tar-zxvf familyA.tar.gz
3: After packing, compress with bzip2
1:TAR-JCVF familyA.tar.bz2 Familya
Split Package
sudo tar-jxvf familyA.tar.bz2

Linux Common Commands--(vi)

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.