Write in front:

Hello, everyone! In the last article we looked at linux-related deployment issues;

This time we come to play a common Linux related command, a little interesting;

Mind mapping:


1. Command format.

We just opened FinalShell and it might look something like this:


So let’s explain these;

Root indicates the current login user, localhost indicates the host name, ~ indicates the current host directory, # indicates the user permission, # indicates the super user, and $indicates the common user.

2. Introduction of common directories;

Let’s first switch to the system root directory/and see what common directories are:


Let’s first look at bin and sbin in the root directory /; There are also bin and sbin under user; Look at the difference between the two;


Bin and sbin in the root directory, bin and sbin in the usr directory, these four directories are used to store system commands.

bin:

Short for binary, bin puts necessary executables such as cat, cp, chmod df.

/usr/bin:

Main to place some application software tools necessary executable files such as c++, g++, GCC, CHDRV;

/sbin:

The main to place some system management necessary programs such as :cfdisk, DHCPCD, dump;

/usr/sbin:

Place some network management essentials such as DHCPD, HTTPD, and IMAP.

Sbin differs from bin:

The commands in the bin directory can be run by both common and root users, but the commands in the sbin directory can be run by only root users.

Other commands in the system root directory:

/bootDirectory, is the boot directory, save is the boot related files; Do not store things in this directory;
/devDirectory for saving device files
/etcDirectory for saving configuration files
/homeHome directory for ordinary users
/libSystem library save directory /mntSystem mount directory /mediaMount the directory /rootThe home directory of the superuser /tmpThe temporary directory /procA virtual file system that writes directly to memory /sysA virtual file system that writes directly to memory /varSystem related documentsCopy the code

3, ls command.

You can not only view the files contained in the Linux folder through the ls command, but also view the file permissions (including directories, folders, file permissions) to view the directory information, etc.

-a: All files are listed, along with hidden files (files starting with.)-A: All files, including hidden files, but not including... and... These two directories, listed together ~Copy the code

-d: Lists only the directory itself, not the file data within the directory-f: Lists the results directly without sorting them (lsThe default is sort by filename!-F: Gives additional data structures based on information such as files and directories, for example: * : represents executable files; / : indicates the directory. = : on behalf ofsocketFiles; | :FIFOFiles;-h: File capacity in a way that is human-readable (e.gGB.KBEtc.) to list;-iList:inodeLocation, rather than listing file attributes;-l: serial output of long data, including file properties and other data;-nList:UIDGIDInstead of user and group names (UIDwithGIDWill be mentioned in the account management!-r: Reverse output the sorting result, for example: the original file name from small to large, reverse is large to small;-R: is listed together with the contents of subdirectories;-SSort by file size!-t: Sort by timeCopy the code

4, CD command;

CD Syntax of the changeDirectory (CD) command. Mainly can switch directories;

cd /root/DocementsSwitch to directory /root/Docements
cd. /path# Switch to the current directorypathDirectory, ". Represents the current directorycd ../pathSwitch to the upper directorypathIn the directory, ".." Indicates the directory at the previous levelcdReturn directly to the home directory where you opened itroot
Copy the code

5. directory processing command;

  • Create directory mkdir;


  • Delete a file or directory rm -rf;

    Delete the empty directory rmdir.


    Delete a file or directory rm -rf;


  • Cp command to copy files or directories;

    Copy file: cp(option)(source file or directory)(destination file);


    Options :(here corresponds to the options in cp command above);

    -rCopy directory-pCopy along with file attributes-dIf the source file is a link file, copy the link properties-aThe equivalent of-pdr
    Copy the code

    Copy directory;


  • Cut or rename command: mv (move)

    Clip file: mv(source file directory)(target directory);


    Clipping directory;



    Well, today is the first to share here, next time to continue to bring you Linux learning!

    More dry goods, quality articles, welcome to pay attention to my original technology public number ~


This article is formatted using MDNICE