Linux Learning Notes (iii)

Source: Internet
Author: User

1. Directory Issues
[Email protected] tmp]$ CD ~
[[email protected] ~]$ ls
Desktop Music Templates vmwaretools-10.0.5-3228253.tar.gz
Documents Pictures tmp Vmware-tools-distrib
Downloads Public Videos
[[Email protected] ~]$ CD tmp
[[email protected] tmp]$ ls
Demo.txt test.sv


[Email protected] tmp]$ CD ~
[Email protected] ~]$ cd/tmp
[[email protected] tmp]$ ls
SSH-CELJG8QCLI systemd-private-ed6wp3 Systemd-private-vetobu
SSH-LFPCYQGML5 systemd-private-eh7m2y systemd-private-x8ible
Ssh-mghwm1iacnif Systemd-private-gvwybi Systemd-private-xn7opi
Systemd-private-0spuse SYSTEMD-PRIVATE-IHRJDC Systemd-private-z2poph
systemd-private-bphu3q SYSTEMD-PRIVATE-JNMOVG Vmware-root
systemd-private-bruq6z systemd-private-ldfm68
Systemd-private-cn4way Systemd-private-pwxauq

As the result of the execution of the above two orders;
The first one:
CD ~ #回到用户家目录, if you are using root login, execute this command and return to the/root directory. If another user is logged in, it is returned to the/home/directory.
CD TMP represents the current user identity under the home directory TMP directory

The second one:
Cd/tmp represents the root directory/tmp directory below

2. ls command:
ls [-aadffhilnrrst] directory name
ls [--color={never,auto,always}] Directory name
ls [--full-time] directory name

Option no parameter:
-A: All files are listed together with the hidden file (files that begin with.) (common)
-A: All files, together with hidden files, but not included. And.. These two directories
-D: Lists only the directory itself, not the profile data in the directory (common)
-F: Lists the results directly without sorting (LS presets are sorted by file name!) )
-F: Give additional data structures based on information such as files, directories, etc., such as:
*: Represents the executable file;
/: Representative directory;
=: Represents the socket file;
|: represents FIFO file;
-H: List the file capacity in a more readable way (e.g. GB, KB, etc.);
-I: List inode numbers;
-L: Long data serial out, including the file attributes and permissions and so on data; (common)
-N: Lists the UID not the GID but the name of the user and the group;
-r: Reverse output of the sorting results, for example: the original file name from small to large, the reverse is from large to small;
-R: Together with subdirectory contents, all files in the directory will be displayed;
-S: Sort by file size, not by file name;
-T: Sort by time, not by file name.
--color=never: Do not give color display according to the file characteristics;
--color=always: Display Color
--color=auto: Let the system decide whether to give the color according to the setting
--full-time: Output in full time mode (package ton of year, month, day, hour, minute)
--time={atime,ctime}: Output access time or change the permission attribute time (CTime) instead of the content change time (modification times).

Example:
Ls-al ~--> List all the files in the home directory (including attributes and hidden files);
Ls-alf--color=never ~--> undertake above, do not display color but at the end of the file name shows the type of the filename represented (type)
LS-SL--full-time ~ Modified time of complete rendering profile


3. CP (copy files or directories)
CP [-ADFILPRSU] source file (source) destination file (destination)
CP [option] source1 source2 source3 ... directory

Options and Parameters:
-D: If the source file asks the property of the link file, the link file property is copied instead of the file itself;
-F: For force, if the target file already exists and cannot be opened, then try again after removing it;
-I: If the target file (destination) already exists, the action will be asked before overwriting; (common)
-L: The connection file for hard link is established rather than copying the file itself;
-P: Copy the past with the attributes of the archive, rather than using the default properties; (Backup common)
-R: Recursive continuous replication, used for directory replication behavior; (common)
-S: Copy as a symbolic link file (symbolic link), i.e. [shortcut] files;
-U: Update destination If destination is older than source.

Note: If the source file has more than two, then the last directory file must be [directory].

Example 1: Copy the Demo.txt under the home directory TMP to the folder share
[email protected] tmp]$ CP ~/tmp/demo.txt/mnt/hgfs/share
[Email protected] tmp]$ Cd/mnt/hgfs/share
[[email protected] share]$ ls
DEMO.SV Demo.txt test.sv

Example 2: Copy the Demo.txt under the home directory TMP to the folder share, repeat two actions, plus-I after the overwrite will ask whether the user is determined.
[email protected] share]$ CP ~/tmp/demo.txt/mnt/hgfs/share
[Email protected] share]$ cp-i ~/tmp/demo.txt/mnt/hgfs/share
Cp:overwrite echnical? mnt/hgfs/share/demo.txt echnical? Y
[[email protected] share]$ ls
DEMO.SV Demo.txt test.sv

Example 3: Copy the/mnt/hgfs/share/note.txt to ~/tmp with REHL7 's identity:
[Email protected] share]$ CD ~
[[Email protected] ~]$ CD tmp
[[email protected] tmp]$ ls
Demo.txt test.sv
[Email protected] tmp]$ cp/mnt/hgfs/share/note.txt .--> Note:. Represents the current directory
[Email protected] tmp]$ ls-l/mnt/hgfs/share/note.txt note.txt
-rwxrwxrwx. 1 root root 0 Apr 23:51/mnt/hgfs/share/note.txt
-rwxrwxr-x. 1 rehl7 rehl7 0 Apr 23:52 note.txt


4. Unzip the file:
. tar.gz format extracted to TAR-ZXVF xx.tar.gz

. tar.bz2 format extracted to TAR-JXVF xx.tar.bz2

Linux Learning Notes (iii)

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.