Common Commands under Linux

Source: Internet
Author: User
Tags bz2

ls:

is to display the file in the current directory

LL:

is to display the file details in the current directory.

Description of the file attributes:

There are a total of file attribute fields Ten A letter composition ,

The first letter indicates the type of file,If the letter is a minus sign"-",indicates that the file is a regular file.Letters"D"indicates that the file is a directory,Letters"D",is aDirtectory (Catalogue)the abbreviation.Please note,A directory or a folder is a special file.,This special file holds information about other files and folders..If the letter is"L",indicates that the file is a symbolic link.The concept of symbolic links is similar toWindowsshortcut in the.

after the first field 9 A letter representing the permissions of the file .

the first three of them represent the permissions of the file owner , Middle Three represents group user rights , The last three represent other user rights .

R table is read (Read) W represents writing (Write) x represents the execution (EXecute)

Useradd:

Useradd – G sales Jack – G company,employees//-g : Join the main group, - G : Join a secondary group

    • Groupadd

      as : Groupadd dba

    • Wget

Download the file at the specified address

such as: wget http://download.redis.io/releases/redis-2.8.3.tar.gz

Tar

Extract
Syntax: tar [main option + Secondary options] file or directory

When you use this command, the main option is required, and it tells Tar What to do, auxiliary option is auxiliary use, can choose.

Main options:

C create a new profile. Select this option if the user wants to back up a directory or some files. Equivalent to packaging.

x release the file from the archive file. Equivalent to unpacking.

T List The contents of the archive file to see which files have been backed up.

in particular, in the release of parameters, c/x/t only one can exist! Cannot exist at the same time! Because it is not possible to compress and decompress simultaneously.

Accessibility Options:

- Z : Do you have both gzip 's properties? i.e. do I need to compress or decompress with gzip? The general format is xx.tar.gz or xx. tgz

-j : Do you have both bzip2 's properties? i.e. do I need to compress or decompress with bzip2? The general format is xx.tar.bz2

- v : Files are displayed during the compression process! This common

- F : Using the file name, please note that the F then you need to pick up the file name now! Don't add any more parameters!

- P : Use original properties of original file (attributes will not change according to user)

--exclude FILE : In the process of compression, do not use the FILE Pack it Up!

Such as:

Tar-xzf redis-2.8.3.tar.gz decompression

tar-cvf/tmp/etc.tar/etc <== package only, do not compress!
Tar-czvf/tmp/etc.tar.gz/etc <== after packing, compress with gzip

tar-cjvf/tmp/etc.tar.bz2/etc <== after packaging, to bzip2 Compression

Make

Compile

Mkdir
Create a Directory

mkdirp If the parent directory does not exist , establish the parent directory.

Rm

Delete file (clip)

RM-RF Catalog Name
- R is recursive down, no matter how many levels of directory, delete
- F is to directly forcibly delete, do not make any hint of meaning

Touch

Creates a new file.

Chown

Use The chown command modifies the user to which the file or directory belongs:

command: Chown User directory or file name

For example: chown qq/home/qq ( The owner of the QQ directory under the home directory changed to QQ User )

Chgrp

Use The CHGRP command modifies the group to which the file or directory belongs:

command: chgrp Group directory or file name

For example: chgrp qq/home/qq ( the home directory of the QQ directory belongs to the group to QQ Group )

How to execute the program:

1. if There is a directory of your program in path, execute filename directly
2. if There is no directory for the program in path, enter the directory ./filename or Path/filename

Telnet

[[Email protected] redis]$ telnet 127.0.0.1 6379

Trying 127.0.0.1 ...

Telnet:connect to address 127.0.0.1:connection refused – connection failure

[[Email protected] redis]$ telnet 127.0.0.1 6379

Trying 127.0.0.1 ...

Connected to 127.0.0.1.

Escape character is ' ^] '. -The presence of this represents a successful connection.

Quit-Enter quit to quit

+ok

Connection closed by foreign host.

Cp

File copies such as:

CP redis.conf/etc/redis.conf

Ps

View process

Such as:

[Email protected] etc]$ Ps-ef | grep Redis

Root 4122 1854 0 09:57? 00:00:00 Sshd:redis [Priv]

Redis 4126 4122 0 09:57? 00:00:00 sshd: [Email protected]/0

Redis 4128 4126 0 09:57 pts/0 00:00:00-bash

Root 6138 6077 0 10:03 pts/0 00:00:00 su redis

Redis 6139 6138 0 10:03 pts/0 00:00:00 bash

Root 6293 6184 0 10:11 pts/0 00:00:00 su redis

Redis 6294 6293 0 10:11 pts/0 00:00:00 bash

Redis 6536 1 0 10:27? 00:00:00 redis-server *:6379

Redis 6548 6294 0 10:28 pts/0 00:00:00 ps-ef

Redis 6549 6294 0 10:28 pts/0 00:00:00 grep--color=auto Redis

netstat

View ports

Such as:

--6379 is a Redis Port number

[Email protected] etc]$ Netstat-nap | grep 6379

(Not all processes could is identified, non-owned process info

Would is not being shown, you would has to be the root to see it all.)

TCP 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 6536/redis-server *

TCP6 0 0::: 6379:::* LISTEN 6536/redis-server *

--6536 is to use PS Check to see Redis Process ID

[Email protected] etc]$ Netstat-nap | grep 6536

(Not all processes could is identified, non-owned process info

Would is not being shown, you would has to be the root to see it all.)

TCP 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 6536/redis-server *

TCP6 0 0::: 6379:::* LISTEN 6536/redis-server *

View All ports

[Email protected] etc]$ netstat-a

Vi

Enter VI file name into VI command mode

Enter I enter edit mode to change and press ESC to exit

Then, this is the command mode, the command is as follows:

: W Save

: Q exit

: Wq Save and exit

: wq! File owner ignores file's read-only attribute save directly and exit

Kill

Kill-2 : Features similar to Ctrl + C is that the program can save the relevant data before it is finished, and then exit.

Kill-9 : Directly force the end of the program.

Common Commands under Linux

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.