linux system classic basic commands

linux system classic basic commands

1.sudo

This is the most important command SuperUserDo Linux novice to use. Require root privileges each command requires the sudo command. You can use sudo before each command requires root privileges.

$ Sudo its

2.ls(list)

Just like everyone else, you often want to see anything inside the directory. With the list command, the terminal will display all files and directories that you're dealing with inside the folder. I suppose in the / home folder inside, you want to see / home directory and files inside.

/home$ ls

3.cd

Change directory (cd) command is always used in the main terminal. It is one of the most basic Linux command. Use this command is very simple. Just enter the name you want to enter from the current directory to that folder. If you want to return to the previous level, as long as the double-dot (..) as a parameter.

I suppose in the / home directory, always wanted to get into the usr directory in / home inside. Here is my method can use the cd command:

/home $ cd usr

/home/usr $

4.mkdir

Just change the directory is not comprehensive. Sometimes you want to create a new folder or subfolder. You can use the mkdir command to do this. As long as you can back your files in the folder name on the terminal mkdir command.

~$ mkdir folderName

5.cp

Copy and paste is an important task of our organization in order to organize your files and needs to be done. Use cp will help you to copy and paste files from the terminal. First, you determine which files you want to copy, and then enter the destination location, you can paste the file.

$ cp src des

Note: If you copy files to any new document root directory permissions are required, then you need to use the sudo command.

6.rm

rm This command can remove your files, or even remove your directory. If the file requires root privileges to remove, you can use the -f. You can also use the -r to recursively removed, thereby removing your folder.

$ rm myfile.txt

7.apt-get

On different distributions, the command is different. In Linux distribution based on Debian's, you want to install, remove and upgrade any software package, we can use the Advanced Packaging Tool (APT) package manager. apt-get command can help you install the software to run on Linux. This is a powerful command-line tool, you can perform the installation, upgrade, and even remove software such tasks.

In other distributions (such as Fedora and CentOS), there are different package manager. Fedora past yum, but now it has dnf.

$ sudo apt-get update

$ sudo dnf update

! ! ! ! ! ! ! ! ! ! ! ! ! !
First, there is the update command: apt-get update, apt- get upgrade, apt-get dist-upgrade the three;
(1) APT-GET Update: Update the index only source packages, roles: the index synchronization source packages information, and further updates the software; USTC a domestic source, faster, get one minute.
(2) apt-get upgrade: Upgrade all packages installed on the system; If the update fails, the packet will be directed to the holding state before update.
(3) apt-get dist- upgrade: upgrade the entire linux system; for example: kali linux1.0.1 upgrade to kali linux1.0.2 from (not only to upgrade all installed packages, and will deal with software conflicts that may arise during the upgrade process in some instances, it's part of the upgrade process requires human intervention).
8.grep

You need to find a file, but they can not remember exactly where or path. grep can help you solve this problem. You can use the grep command, helps to find files based on a given keyword.

$ grep user /etc/passwd

9.cat

As a user, you often need to see some documentation or code from the script. Similarly, one of the basic Linux command is the cat command. It will show you the inside of a text file.

$ cat CMakeLists.txt

10.poweroff

poweroff. Sometimes, you need to shut down directly from the terminal. This command will be able to accomplish this task. Do not forget to add a sudo command at the beginning, because it requires root privileges to perform poweroff.

$ sudo poweroff

11.tar decompress gz file

tar -zxvf *.gz

12.setup python command

sudo python setup.py install

pip install --update pip

13. Change directory

~ Directory user directory / root (ls cd .. cd /)

14. Shortcuts

[Tab] key --- has "command completion," not "padded file" function

[Ctrl] -c keys --- let the current program "stopped"

15.gedit

gedit a.py

16.pwd

Displays the current directory

17.bash

bash is a program written for GNU Unix shell. Its name is a series of abbreviations: Bourne-Again SHell - This is the Bourne shell (sh) is a pun (Bourne again / born again).

bash Anaconda2-4.1.1-Linux-x86_64.sh

18.su

How to switch to root linux

$su - root

$ Enter the root password.

19. Change the pip source

You can add parameters -i https://pypi.tuna.tsinghua.edu.cn/simple when using the pip

For example: pip install -i https://pypi.tuna.tsinghua.edu.cn/simple gevent, this will go from the image side of the mounting Tsinghua gevent library.

20.chmod

Linux permissions to view folders: ls -ld name of the folder (directory)

Modify file and folder permissions:

sudo chmod - (representative of the type) ××× (owner) ××× (group of users) ××× (other users)

Common modify permissions command:

sudo chmod 600 ××× (Only the owner has read and write access)

sudo chmod 644 ××× (owner has read and write access, read-only user group permissions)

sudo chmod 700 ××× (Only the owner has read and write, and execute permissions)

sudo chmod 666 ××× (everyone has permission to read and write)

sudo chmod 777 ××× (everyone has read and write, and execute permissions)

 

 

Author: Ali cloud Yunqi community
link: https: //zhuanlan.zhihu.com/p/35087572
Source: know almost
copyrighted by the author. Commercial reprint please contact the author authorized, non-commercial reprint please indicate the source.

1.wget
wget is a file search tool, with a basic rule of thumb is remotely download files.


2.cat
CAT is the file's contents to standard output. The name comes from concatenate. Together for combining two files (the actual connection), attach a file to another file, the file number lines and the like.


3.wc
WC for generating words, the content number of rows, the number of bytes of the text file. When the option is empty, wc default output row, left to right are: the number of lines, words (single string in each row without interruption are counted as a single word), and the number of characters in the file name (s).


4.head
head of the first n lines of the file (10 default) standard output. -n option to set the number of rows displayed.


5.tail
tail trailer information for the output file.


The Find 6.
the Find search for a specific file in the file system.
Meaning the figure below command: ( ".") Start searching to "iris" start any type of character at the end ( "-name'iris * '"), common file types ( "-type f") of the file from the current directory .


7.cut
Cut used to extract from a text file. While the column can be extracted using various criteria for production, but the cut may be used to extract a portion of data from the CSV file.
FIG meaning of the command is: Use a comma ( "-d ','") as the field separator output of the fifth column ( "-f 5") iris.csv file.


8.uniq
uniq check and remove the same row or column, the text file to standard output. When building the command line pipe, this command may be useful: the output of a command and the like to the input of another command.
Meaning the drawing command: iris data set lists the class name in the fifth column of repetitions.

 

 

9.awk
awk is not really a "command" but a complete programming language. And extracting text for processing, and may be a single line command in the command line call.
Awk takes some time to master, but before, this is an example that it can be easily done. Given our sample file iris.csv rather limited (text, especially when it comes to diversity), the bank calls awk, search in a given file ( "iris.csv") within the string "setosa", and one by one print to standard output, and prints the entire line (stored in the variable $ 0).


Grep 10. The
grep is another text processing tool for the matching string and a regular expression.


Sed 11. The
Sed is a stream editor, is another text processing and conversion tool, similar to awk. Under the command of the meaning of the figure: the iris.csv file "setosa" changed to "iris-setosa".


12.history
History is very simple, especially if you rely on a used copy command, which is particularly useful.


More than 12 commands are the most basic command-line tool

Guess you like

Origin www.cnblogs.com/LL-HLK/p/11740327.html