Linux Common basic commands

Source: Internet
Author: User
Tags parent directory

Outline

First, LS

Second, CD

Third, CP

Iv. Date

Wu, Hwclock

Vi. getting the use of commands help

Vii. Man Document Chapters

Viii. Root File system





First, LS (list)

ls - list directory contentssynopsis       ls [ Option]... [file] ... [[email protected] ~]# ls -lh /root/total 8.0k-rw-r--r-- 1 root  root 208 jul  6 13:41 id_rsa_1024.pub-rwxr-xr-x 1 root root  518 oct 26 21:33 iptables.sh       -l: Long Format                File Type:                 -: Normal file   (f)                  d:  Catalog Files                  b:  Block device files   (block)                  c:  character device files   (character) & Nbsp;               l:  Symbolic Link file ( Symbolic link file)                  p:  command Pipe file (pipe)                  s:  socket file (socket)           file permissions: 9-bit, Each 3-bit group, each group: rwx (Read, write, execute) Number of hard links to, r--          files    The owner of the         file (owners)           Genus Group           file size (size) of the file, in bytes            timestamp (timestamp): Last Modified time                   Access Time:access                  Modified: Modify, the file content has changed                   Change time: change,metadata, meta-data     -h: do unit conversion     -a:  Show hidden files with. Start     .  represent current directory     .   Represents parent directory     -A:  displays all files but does not include. and.     -d:  display the directory itself properties     -i:  display the inode number of the file     - r:  Reverse Display     -R:  recursive (recursive) display     -t: Lists the document in the order of the modification time



Ii. CD (change directory)

[[Email protected] tmp]# CD [[email protected] ~]# CD ~username: Go to the home directory CD of the specified user--switch back and forth between the current directory and the previous directory, like the remote control's Return key CD: : Back to top directory CD: Go to your home directory



Third, CP (copy)

Cp - copy files and directoriessynopsis       cp  [option]... [-t] source dest       cp [option] ...  SOURCE... DIRECTORY       cp [OPTION]... -t  directory source...                    -a:--archive, the effect of this parameter is the same as specifying the "-DPR" parameter at the same time;      - D:--no-dereference --preserve=link, when a symbolic connection is copied, the destination file or directory is also established as a symbolic connection and points to the original file or directory connected to the source file or directory;     -f: Forcibly copy a file or directory, regardless of whether the destination file or directory already exists,      -i:--interactive to ask the user before overwriting the existing file;      -l: A hard connection to the source file, not a copy of the file;      -p: Retain the original file permissions when copying, belong to the main group, timestamp      -R/R: Recursively handles all files in the specified directory with subdirectories,      -s: Creates a symbolic connection to the source file rather than copying the file;      -u: Using this parameter will only change the source file when it is updated with the target file or the name of each otherThe file is copied only when the corresponding target file does not exist;      -s: When backing up a file, replace the default suffix of the file with the specified suffix "SUFFIX";      -b: The target file is backed up before overwriting the existing file target;      -v: Displays the actions performed by the command in detail.

(1). The source is a file, the target exists and is a directory, copy the file to the directory and keep the original

[Email protected] ~]# cp/etc/issue/root/[[email protected] ~]# ls/root/id_rsa_1024.pub iptables.sh Issue

(2). Source is a file, the target exists and is a file, the copy will prompt whether to overwrite

[Email protected] ~]# cp/etc/passwd/root/issuecp:overwrite '/root/issue '? Y

(3). If the source is a file and the destination does not exist, copy the file to the directory and rename it

[Email protected] ~]# cp/etc/issue/root/testfile[[email protected] ~]# ls/root/id_rsa_1024.pub iptables.sh Issue Testfile

(4). The source is multiple files, the target must be a directory and have to exist beforehand, or it will be an error

[Email protected] ~]# cp/etc/passwd/etc/passwd/etc/fstab/root[[email protected] ~]# ls/root/fstab ID_RSA_1024.P UB Iptables.sh Issue Testfile


Iv. Date

date - print or set the system date and timesynopsis        date [OPTION]... [+FORMAT]        date [-u|--utc|--universal] [mmddhhmm[[cc]yy][.ss]]    %h  hours, 24-hour (00~23)      %I  hours, 12-hour (01~12)      %k  hour, 24-hour (0~23)     %l  hours, 12-hour (1~12)      %M  min (00~59)       %p  display time of AM or pm     %r , 12-hour (hh:mm:ss %p)       %s  from January 1, 1970 00:00:00 to the current number of seconds      %S  display seconds (00~59)      %T  display time, 24-hour system (HH:MM:SS)      %X  display time format (%h:%m: %s)      %Z  display time zone, date field (CST)      %a  week abbreviation (SUN~SAT)      %a&nbspThe full name of the week (sunday~saturday)      %h,%b  month abbreviation (JAN~DEC)      %b Full name of   month (January~december)      %c  Date and time (tue nov 20 14:12:58  2012)      %d  Day of the one month (01~31)      %x,%D  date (mm/ DD/YY)      %j  Day of the Year (001~366)      %m  month (01~12)      %w  one days of the week (0 for Sunday)      %W  Week of the year (00~ 53, Monday is the first day)      %y  the last two digits of the year (1999 is 99)

(1). Output current date time, output format is year-month-day time: minutes: seconds

[[Email protected] ~]# date + "%y-%m-%d%h:%m:%s" 2015-11-01 14:19:14

(2). Modify the current date time

[[Email protected] ~]# date 102412342015.30Sat Oct 12:34:30 CST 2015

(3). Output current date only, output format is year-month-day

[Email protected] ~]# date +%f2015-10-24

(4). Show "Today is the year-month-day"

[[Email protected] ~]# Date + "This is%y%ntoday are%d" This is 2015Today is 01

(5). Gets the number of seconds traveled from January 1, 1970 to today

[Email protected] ~]# date +%s1446360306


PS: The meaning of the above parameters is derived from http://man.linuxde.net/


Wu, Hwclock

 hwclock - query and set the hardware clock  (RTC)  synopsis        hwclock -r or hwclock --show        hwclock -w or hwclock --systohc        hwclock -s or hwclock --hctosys        Hwclock -a or hwclock --adjust       hwclock -v  or hwclock --version       hwclock --set --date= newdate       hwclock --getepoch        hwclock --setepoch --epoch=year                   -W: To the system time, the system time synchronization to the hardware time, that is, the hardware time is changed-s:  the hardware time, the hardware time synchronization to the system time , which is changing the system time


(1). Hardware clock is not allowed, with the system clock, the system clock synchronization to the hardware time

[[email protected] ~]# hwclock Sat Oct 12:37:00 PM CST-0.196319 seconds[[email protected] ~]# Datesun Nov 1 14: 36:21 CST 2015[[email protected] ~]# hwclock-w[[email protected] ~]# hwclock Sun 02:36:39 PM CST-0.869126 s Econds


(2). System clock is not allowed, hardware clock, the hardware clock synchronization to the system time

[Email protected] ~]# hwclock Sun 02:32:26 PM CST-0.825691 seconds[[email protected] ~]# Datesat Oct 24 12: 45:31 CST 2015[[email protected] ~]# hwclock-s[[email protected] ~]# datesun Nov 1 14:32:50 CST 2015










This article is from the "Hello,linux" blog, make sure to keep this source http://soysauce93.blog.51cto.com/7589461/1708527

Linux Common basic commands

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.