Common Linux basic commands

Source: Internet
Author: User
Linux is free, but it is indeed a very good operating system, compared with the MS-WINDOWS is reliable,
Stable, fast, and other advantages, and has a wide range of powerful functions improved according to the unix version. Below, as a typical DoS
With Windows users, let's take a look at some of the main Linux commands and hope that everyone can enter the Linux world as soon as possible.
1. Start
The Startup Process of Linux is similar to that of DOS (however, as the operating system itself, Linux does much more work at startup and exit than DoS). You can also press
CTRL + ALT + DEL three keys for hot start. The difference is that when Linux is started to the end, you need to log on. The following is a typical logon process:
......
RedHat Linux release 5.1
Kernel 2.0.32 on an i686
Login:
After you type: root, the computer will display the password (password :) and enter your password (if it is the first time you start, it is the password you entered during installation. When the computer displays a "#" prompt, it indicates that you have successfully logged on!
[Root @ localhost root] # _ Linux prompt
C: \> _ DOS prompt
Ii. Common commands:
1. display the file directory command ls (DIR in DOS)
Use the LS command in Linux to display files and directories (of course, you can still use the Dir command, but the parameters here are different ). Example: # ls
Root MNT boot Dev bin USR Xiong TMP etc games
It seems simple (equivalent to "DIR/W" in DOS), but you will find that what you see is hard to understand, even which directories and files are unclear, what are executable files? No
Please enter: # ls-F + root/mnt/boot/dev/bin/usr/Xiong * tmp/etc/games/
Readme
See it clearly, with * executable files (equivalent to EXE and COM files in DOS),/as sub-directories, and others as common files. In addition, we can
Use LS-L to display the details of the file directory (equivalent to the Dir command in DOS ). Be case sensitive !! Such as ls
-F, ls, and so on are all incorrect. In addition, the LS command has many parameters. You can use man ls or ls -- help to learn more.
2. Change the current directory command Cd (CD in DOS)
In dos, we can use c: \> CD \ MNT \ CDROM or CD \ MNT \ CDROM
C: \ MNT \ CDROM> Cd... or CD ..
C: \ MNT> CD \ or c: \ MNT> CD \
In Linux, CD, MNT, and CDROM are used. The directory name must be in the same case as the actual one, and there must be spaces after CD.
PWD displays the current directory
CD .. it must be lowercase and contain spaces
The CD/directory is/, and the CD and/must contain spaces.
3. Create a subdirectory mkdir (MD or mkdir in DOS)
In Linux, only mkdir can be used. relative paths and absolute paths are available. Please compare:
C: \> MD Xiong or MD \ Xiong
Dossystem
[Root @ localhost/] # mkdir Xiong or mkdir/Xiong
Linux
4. Delete the subdirectory command rmdir (RD in DOS)
In Linux, run the rmdir command to delete sub-directories, for example:
Rmdir/mnt/CDROM is equivalent to RD \ MNT \ CDROM
Note: Like Dos, The subdirectories to be deleted must be empty and must be in the upper-level directory to delete the lower-level subdirectories.
5. Run the delete file command RM (DEL or earse in DOS)
In Linux, run the RM command to delete an object. For example:
Rm/UCDOS. bat is equivalent to Del \ UCDOS. bat
6. The file RENAME Command mV (REN or rename in DOS) is used in Linux to rename the file. For example:
MV/mnt \ floppy P is equivalent to Ren \ MNT \ floppy P
Note: In addition to renaming a file, the MV command in Linux also provides the file movement function. See the example below:
MV/mnt/floppy/bin is equivalent to the DOS command move \ MNT \ floppy \ bin
7. file copy command CP (copy in DOS)
Use the CP command in Linux to copy files, for example:
CP/UCDOS/*/Fox is equivalent to copy \ UCDOS \ *. * \ Fox
Note: *. * In DOS is replaced by * in Linux.
8. Command man for obtaining help information (help in DOS)
Use the man command in Linux to obtain help information, for example:
Man ls is equivalent to help dir
Ls -- help is equivalent to Dir/
9. Show the file content less (type in DOS)
In Linux, run the less command to display files. For example, to display the content of mwm. lx in the Man1 sub-directory, enter [root @ localhost Man1] # less mwm. lx, that is
Yes. In Linux, we can also use another command "more" to display the file content, for example: More
Mwm. lx. As you can see, these two commands are very similar. In fact, the less commands have better functions than the more commands. You can explore them yourself. In Linux, two DoS
There are no commands for reading files. They are head and tail commands used to display part of the file's header and back. The format is head (tail) [M]. If the default value is N, 10 rows are displayed. For example:
Head/usr/man/mwm. Lx: displays the contents of the first 10 lines in the file mwm. lx.
Head 15/usr/man/mwm. Lx display the contents of the first 15 lines of the file mwm. LX
Tail 17/usr/man/mwm. Lx displays the contents of the last 17 lines of the mwm. Lx file.
10. redirection and Pipelines
As you know, in DOS, we can easily perform some special operations through redirection and pipelines, such as: dir> direct to put the current directory into the file direct;
Type readme> direct: append the content of the file readme to the file direct. Another example is type.
Readme.txt | more, the contents of the prepare file readme.txt are displayed on the page. In Linux, the redirection and pipeline operations are almost the same as those in DOS. The preceding two examples are as follows:
In Linux, the child should be: ls> direct; less
Readme.txt | more (note: in fact, the more and less commands in Linux have paging functions ).
11. Shell: Command Interpreter)
In the dossystem, most of our users use the command.com command interpreter. Of course, you can use Norton or dos4.0 or later.
Dosshell. There are several shell types in Linux. Common examples include ash, Bash, KSh, tcsh, and zsh. From the preceding environment variables, shell =
/Bin/bash shows which shell you are using and where it is located. The default computer type is Bash.

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.