Command parsing in Linux

Source: Internet
Author: User
Tags clear screen time and date

Command parsing:


[[Email protected]~]#


[] No special meaning

Root: Currently logged on user (Admin user)

@ No special meaning

LocalHost host name

~ Represents the current location (~ home directory)

# represents the current logged-on user as an administrator

$ if it is $ then normal user

-----------About Documents

Format:

Command + options (Action object) + parameters

(individual commands used do not follow this format and can be written together when there are multiple options)


Display file : ls (ll:ls-l)

-A All information (. Starts with hidden files-system files)

-LH regular format display (plus h for humanized display)

-D View Directory properties

-H humanized Display

-I display the file ID number


-rw-r--r--. |-|root |root |1207 | 14 18:18| Install.log

File and Permissions | Reference count (number of visits) | file owner | owning Group | size | time | file name


1. There are 7 types of files in Linux:

Common three kinds:-file D directory L soft connection file

Four other types: block device file, character device file, socket file, pipe file

2. Permission representation of the file (1+9)

-rw-r--r--. : 1+9 ==> file type is represented by first bit permission bit

The latter 9 bits are permission groups, divided into 3 groups: Owner | owning Group | others

u | G | o <--operation right W read/write R x Execute

3. Later ".": CentOS6 appears, indicating ACL permissions

4. User groups: Same identity with same permissions



To create a file :

mkdir-p [directory name]: Plus option p is recursively created

Touch [directory Name]: Create an empty directory


Cd:

cd~ CD back to home directory root

Cd.. Superior

Cd. Current

CD-Go to last directory

(Ctrl+l clear screen)


Absolute path: Root is the reference, Root begins

Relative path: In the current directory as a reference


RM: Deleting files

Rm-r [xx]: Delete the directory, there are sub-files will be asked to delete

RM-RF [XX]: Forced to delete directories and files inside

exp:rm-rf/temp/* Delete all under Temp


CP [-r] [original file] [new file path]

Note: Specifying a new directory means that adding-r means replicating the directory and not copying the file

CP-ADP: Copy file as the original file plus-a


MV [directory or file] [target file]

MV japan//tmp/japan

If the cut is represented in the same directory


-------Several other common commands

ifconfig: Super User use

Address parameters for viewing and changing network interfaces, including IP address netmask, broadcast address

Ifconfig-interface [Options] Address

Parameters can be used:

-interface specifying the network interface name

Up activates the specified network interface

Down interface

Broadcast address to set up broadcast addresses for interfaces

Pointopoint enable Point-to-point mode

Address settings Specifies the IP of the interface device

Netmask Address Set interface sub-mask


echo: Display a paragraph of text, play the role of prompting

echo [-ne] [string]

Parameters can be used:

-N Do not wrap in the last line

-E If the following signifier characters appear in the string, the

\a Audible warning \b Delete the previous character \c end with line break

\f Wraps but the cursor remains in its original position \ n Wraps and the cursor is to the top of the line

\ r cursor moves to the beginning of line, does not wrap \ t Insert tab

\v the same as \f \ \ insert \ Character

TTY: Print the terminal file name connected to the standard input

TTY [-S]

Available parameters:

-S nothing to print just return the eject status code


startx: Start X window Service

STARTX [Program] [-Server Settings]

Available parameters:

-D displays specifies the display name of the X server that is passed to the X client during startup

-M Window_manager Startup Window management when no startup script is found

-R Resources when the startup script is not found, mount the resource file

-T launches x client for an X terminal

-W launches x server and x client for X-window session on workstation

-wait prevents the X session from restarting when the XDM command calls StartX

-X startup uses the startup script to start an X. window session


Export: setting or displaying environment variables

Export [-fnp][variable name]=[variable setting value]

Parameters can be used:

-F represents the function name in [variable name]

-n Deletes the specified variable (the variable is not actually deleted, but is not exported to the execution environment of the subsequent instruction)

-p lists all the environment variables that the shell assigns to the program


pwd : View the full path to the current working directory

PWD [-PLP]

Parameters can be used:

-P Show actual path, non-connection path

-L Output Connection path when directory is connected

-P Output Physical path


History: View Historical input

History [N-CARW]

Parameters can be used:

N numbers list the last n commands

-C Removes all history content from the current shell

-A adds the currently added instruction to the Histfile

-R Read Histfile's content to the Shell's history

-W writes the current history memory to Histfile


shutdown: Turn off the computer

Shutdown [-hikmtcf time]

-H power off after shutdown

-I display system information when shutdown

-K does not really shut down and sends a warning signal to every login

-M changing the system to single-user mode

-T tells the Init program how long to shut down before changing to another runlevel

-C Cancel the current political shutdown program

-F Force fsck to restart the computer

-time setting the time before shutdown

Poweroff: Turn off the computer's operating system and power off

Poweroff [-NWDFIH]

Parameters can be used:

-N Do not perform sync operation when shutting down the operating system

-W does not really shut down the operating system, only "/var/log/wtmp"

-D does not write "/var/log/wtmp" when shutting down the operating system

-F Force shutdown of the operating system

-I shut down all network interfaces before shutting down the operating system

-H set all hardware in the system to standby mode before shutting down the operating system


reboot: Restart the computer

Reboot [-NWDFI]

Parameters can be used:

-N Do not write the memory data back to the hard drive before re-booting

-W does not really reboot, only logs to/var/log/wtmp

-D don't write the records into the/var/log/wtmp file.

-I stop all network-related devices before re-booting


hwclock: Display and setup hardware clock

Hwclock [--options]

Parameters can be used:

--adjust Hwclock is recorded in the/etc/adjtime file each time the hardware clock is changed

--DEBUG displays detailed information on Hwclock execution

--directisa Hwclock presets To access hardware clocks from/DEV/RTC devices

--hctosys adjust the system clock to match the current hardware clock

--set--date=< Date and time > Set hardware clock

--show Displays the time and date of the hardware clock

--SYSTOHC adjust the hardware clock to match the current system clock

--test only test the program without actually changing the hardware clock

--utc using GMT


Date: Displays and sets the system date and time

date [parameter] [format]

%H hours (expressed as 00-23)

%I Hours (expressed as 01-12)

%K hours (expressed as 0-23)

%l hours (expressed as 0-12)

%M min (expressed as 00-59)

%P am or PM

%r time (minutes, seconds, hours in 12 hours am/pm)

Total number of seconds in%s. Starting time is 1970-01-01 00:00:00 UTC

%s seconds (as represented by local idioms)

%T time (minutes and seconds, hours in 24-hour system)

%x time (expressed in local idiomatic notation)

%Z City

%a abbreviation of the Week

Full name of%A week

Abbreviation for%b month English name

Full English name of%B month

%c date and time only input date instructions will also show the same result

%d date (represented as 01-31)

%d Date (including month date)

%j the first day of the year

%m month (expressed as 01-12)

%u number of weeks in the year

%w days of the week, 0 for Sunday, 1 for Monday

%x date (represented by local idiomatic notation)

%y year (expressed in 00-99)

%Y year (expressed in four digits).

%n inserts a new line when it is displayed.

%t when displayed, Insert tab.

MM Month (required)

DD Date (required)

HH Hour (necessary)

MM min (required)

SS sec (Selective)

Parameters can be used:

-D Displays the date and time that the string refers to. Double quotation marks before and after a string

-S sets the date and time based on the string. Double quotation marks before and after a string

-U GMT Display




Command parsing in Linux

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.