Linux Operating System Basics

Source: Internet
Author: User
Tags parent directory

When you encounter some commands that you don't understand, you can look at the command as an internal/external command, and then use the Help/--help/man command to view the help.

Describes how to use some common commands:

1.cd

CD dir switches the working directory to the DIR directory to open the function of the directory file;

The CD switches the working directory to the home directory of the currently logged-in user;

CD-Switches The working directory to the working directory of the first time, and switches between the two directories;

CD ~ Switch The working directory to the home directory;

CD ~usename switches the working directory to the specified user's home directory, which is limited to the root user.

2.pwd

Print the name of the current working directory

3.ls

-a displays all files, including hidden files (in Linux, all files that begin with. are hidden);

-a displays except./. Any items other than, including hidden files;

-D does not display contents of the directory, only the directory name of the directory;

-L long format to display detailed properties of the file;

-H easy-to-read file size format, usually using 1024 bytes for conversion;

-R reverse output;

-R recursively displays the contents of the directory and subdirectories;

-Z Displays the file's SELinux security context;

4.mkdir

Create a catalog file;

-p When creating the directory, check that the parent directory exists, does not exist and creates the parent directory;

-V shows the execution of the command

5.rmdir

The command to delete directory files, but only empty directories can be deleted, and non-directory files cannot be deleted;

Options and mkdir command options extrapolate;

6.rm

Very powerful Delete command

-I interactive deletion with the user;

-F Force Delete, no interaction;

-R recursive deletion;

7.touch

Change the timestamp of the file, but you can create the file;

8.stat

View the status of a file

-C to append a format character to display the specific properties of the file in a specific format;

9.nano

Compare basic text editing commands, do not do too much explanation, mainly use Vi/vim;

10.cat

Connect files and view files, can write multiple files;

-B numbering of non-empty line contents;

-N to number all lines;

-S merge multiple lines of blank behavior row;

-e Displays the terminator at the end of each line in the document, expressed in $;

11.tac

Reverse output of cat;

12.head

The first ten lines of the file contents are displayed by default;

-N Displays the contents of the first n rows of a file, or it can be abbreviated as a digital form;

-C output by character, previous # multiple characters [b|k|m|g];

13.tail

The default display of the following 10 lines of content;

The option is similar to head;

14.more/less

pagination Display command;

But more can only be shown backwards, and less can be displayed back and forth;

Next, you'll describe some of the time-related commands:

15.hwclock (Clock)

Display Hardware clock life

-s with hardware clock as reference, set system clock;

-W with the system clock as the reference, set the hardware clock;

16.date

Commands to display the system clock

17.cal

commands to display calendars

Shutdown command:

18.halt

Not recommended to use, directly unplug the meaning of the system's current operation of the task is not to save;

19.shutdown

Option to operate the shutdown time, but also cancel the shutdown operation;

-R reboot the system, restart the meaning;

-H shut down the system;

-C cancels a shutdown operation that is about to be performed;

20.exit

End the current shell and take advantage of this command to prevent repeated opening of the same user shell, consuming too much system memory;

21.cp

Physical backup, divided into single source replication and multi-source replication, single source replication when the target can be non-existent, multi-source target can be a directory. The CP command requires at least two parameters, usually the last parameter is the target location of this replication, if a single source replication, the target can not exist, the target can be non-directory files, and can change the file name, and the multi-source replication destination must be a directory and the replication process cannot change the file name.

-D copy of the source if it is a symbolic link file, the symbolic link file is copied directly to the target location, not the linked file;

-P is able to preserve file permissions, ownership, and timestamp information when copying files;

-R/R the ability to recursively copy directories and files in a directory;

-A is equivalent to the combination option of the PDR option;

22.mv

Move the file to the target location or use it to change the filename;

-F Force overwrite files with duplicate names in the target location;

23.which

Find out if the executable file exists and where the display resides;

Example: # which VI

/usr/bin/vi

24.whereis

Locates executable files, source code files, and Help files in the file system location.

-B Locate the executable file;

-m location Help file;

-S location source code files;

-U searches the default path for files other than executables, source code files, and Help files;

-b Specifies the path to the search executable file;

-m specifies the path of the search Help file;

-s Specifies the path of the search source code file;

25.whatis

equivalent to running man-f;

Example: Whatis VI

VI (1)-VI improved, a programmer's text editor


Linux Operating System Basics

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.