How to Learn shell commands in Linux

Source: Internet
Author: User
Tags file transfer protocol
How to Learn shell commands in Linux
I learned some of the scattered linux commands today. The following is a summary:
First of all, when you don't know how to execute commands, of course we need man. Let this man save everyone! Haha!
Common network management commands:
Finger: This command can be used to query user information and view the default user environment.
Ftp is a standard file transfer protocol user interface, is the most simple and effective way to transfer files on the TCP/IP network.
Host this command is used for DNS query.
Hostname: this command is used to display or set the Host Name of the system.
The mail command is used to send and receive emails.
Netstat: this command is used to display network connection, route table, and network interface information. You can know which network connections are currently running. Common parameters include:
-A: displays all sockets, including those being monitored.
-C: The network information is re-displayed every second until the user disconnects him.
-I: displays information of all network interfaces in the same format as the "ifconfig-e" command.
-N: replace the name with an IP address to display network connection information.
-R: displays the core route table in the same format as the "route-e" command.
-T: displays TCP connection information.
-U: displays the UDP connection information.
-V: displays the network protocol in progress.

Ping this command to test whether the computer is connected to other computers on the network.
The rsh (remote shell) command is a remote shell command. this command starts a shell on the specified remote host and executes the rsh command. If rsh does not specify a specific command, the rlogin command is enabled to log on to the remote host.
The telnet command is used to log on to a remote computer over the network, as if you were operating on a local computer.
The wget Wget command is used to download files from WWW in Linux. It supports HTTP and FTP protocols, proxy server and resumable data transfer, and automatically recursion of remote host directories, find the desired file and download it to the local hard disk. The Wget command can be run in the background to intercept and ignore the HANGUP signal. Therefore, you can continue running after logging out.

Basic commands for file and directory operations:
The pwd command indicates "print working directory ).
Cd command to change the working directory cd ~ (Go to login directory) cd http://www.cnblogs.com/dir3/dir2 (go to relative directory)
The ls command will display the contents of your current directory.
-? All ). List all files in the directory, including hidden files (. filename ). The... And. At the beginning of the List refer to the parent directory and your current directory.
-L? Long ). List the details of the Directory, including permissions (mode), owner, group, size, creation date, whether the file is linked to other places of the system, and the link pointing.
-F? File type ). Add a symbol after each list item. These symbols include:/indicates a directory; @ indicates a symbolic link to another file; * indicates an executable file.
-R? Reverse (reverse ). List contents in the directory from the back to the front.
-R? Recursion ). This option recursively lists the contents of all directories (under the current directory.
-S? Size ). Sort by file size
Locate command to search for files or directories
The clear command is used to clear terminal windows.
Cat is short for concatenate, which means to merge files.
Head command to view the beginning of the file head-20
Tail: This command can view 10 lines at the end of the file.
The grep command is very useful for finding the specified string in the file.
The chmod command is used to modify the access permissions of files or directories.
Identity u? User (owner) who owns the file; g? Group where the owner is located; o? Others (not the owner or the group Group of the owner);? Everyone or all (u, g, and o)
Permission r? Read permission; w? Write permission; x? Execution right
Action +? Add permissions ;-? Delete permission; =? Make him the only permission
The CP (copy) command can copy files or directories to other directories. CP source> Target>
MV mobile file-I interaction,-F forced-V thorough
Mkdir (make directory) command is used to create a directory
Rm deletes a file or directory-I interaction,-F forces-V thorough-r Recursion
Process Management command:
Kill terminate a program
PS real-world Program Status
File System commands
Dd command is used to copy an object.
Edquota this command can be used to set disk space limits for users and user groups.
Fdisk: this command is used to execute disk partitions in Linux.
Mkfs this command is used to create a Linux File System.
Mount this command is used to assemble a file system.
Quota This command is used to limit and display the available disk space of users.
File compression and archiving commands
Compress, uncompress this command is used to compress or decompress data.
Gzip, gunzip this command is used to compress or decompress files. gzip is a frequently used compression and decompression command in Linux, which is very easy to use.
The rpm command is used to start the RPM software package management operation.
The tar command is used to start the file package.
The unzip command is used to decompress a file named. Zip, which can be compressed by Winzip in the Windows System in Linux.
The zip command is used to package and compress files.
User management commands
Groupadd: this command is used to create a new user group.
Groupmod: this command is used to modify group attributes.
Group this command is used to display the group of the current user.
The passwd (password) command allows you to change the account password. In general, there are several failures to set the account password: the password is too simple, the password is too short, and most of the characters in the password are the same. For example:
The su command is very important. It enables a general user to have the permissions of the ultimate user or other users, and also enables the ultimate user to do things as a general user. However, when you use this command, you must have the password of the ultimate user or another user. To log out of the current user, enter exit.
Useradd this command is the fastest and easiest way to create a user account.
Userdel: this command is used to delete user accounts and related files.
Who:
Whoami this command is used to view the login name of the current user.
Commands related to system management
Free this command is used to view the current system memory usage. It can display the remaining and used physical memory, swap memory, shared memory and kernel buffer in the system.
Shutdown this command is used to shut down or enter the maintenance mode of a single user.
The data command displays the date and time of the current system. The clock command can also be used to display the current system date and time (by default, normal users cannot execute the clock command and must log on to the root account to execute it ). For example:
Cal this command displays the calendar or calendar in the computer. For example:
Write this command is used to send messages to a user in the system. To exit the message sending status, press Ctrl + C.
In addition
Install and uninstall software
Install rpm Software
For example: rpm-Uvh kdevelope-3.1-1.i386.rpm
Uninstall rpm Software
Example: rpm-e kdevelope

Decomtar package
Example: tar-xvzf gaim-0.77.tar.gz
Tar-jxvf XXX.tar.bz2
Generate a tar package
Example: tar cvf-/etc | gzip-9c> backup.tar.gz

Output redirection
By default, Linux receives input from the keyboard and sends the command output to the screen. Sometimes, this is not convenient. For example, there are many files in a directory. If you only use the simple LS command, there may be thousands of lines of output results displayed on the screen! To get the information we need. We may need to store these results in a file and then view the file. This requires the system's output redirection function. The output redirection operator is> or>. A single sign (>) is followed by a file name. If the specified file does not exist, the file will be created. If the specified file exists, the original content of the file will be overwritten. If two greater than signs (>) are used, the output content is appended to the original file. The following is an example:
1. [-(/tmp)> ls/usr/bin> USR. Bin
2. [-(/tmp)> WC-l USR. Bin
3.2171 USR. Bin
4. [-(/tmp)> ls/usr/bin> USR. Bin
5. [-(/tmp)> WC-l USR. Bin
6.4342 USR. Bin
7. [-(/tmp)> ls/usr/bin> USR. Bin
8. [-(/tmp)> WC-l USR. Bin
9.2171 USR. Bin
Note: The row number is added for convenience, not the shell output.
Row 3: The file list in/usr/bin is written to the file USR. bin. The file is automatically created because it does not exist. The number of USR. Bin rows can be seen from row 3rd. Repeat the 4th-line command in line 3. Because the command is>, the file list in usr/bin is appended to the file, and the number of USR. Bin rows is doubled. In row 3, we used>. The file list in usr/bin is written to the file, the original content in USR. Bin is overwritten, and the number of rows is changed to a new value.
MPs queue
Write the standard output of a program into a file, and then use the content of this file as the standard input of another command, which is equivalent to combining the two commands through a temporary file. This situation is very common and requires the Linux system to provide a function that can combine the two commands without having to or without using temporary files. This function is a pipeline. The pipeline operator is a vertical bar "| ". Pipelines can be nested, So multiple commands can be combined. For example, if you run the following command, the number of lines in the/usr/bin file list is directly returned, instead of the list content.
Ls/usr/bin | wc-l

This article is from the ChinaUnix blog. If you want to view the original text, click:Http://blog.chinaunix.net/u/27817/showart_432482.html

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.