Linux Basics Review One

Source: Internet
Author: User
Tags file copy what date

1. List Linux distributions by series and describe the two lines and differences between different distributions.

The current major Linux distributions are:

Slackware:suse

Debian:ubuntu Mint

Redhat:rhel CentOS Fedora

Contact: Because the Linux kernel source code is open, these Linux distributions are based on the Linux kernel.

Difference: Slackware is the oldest Linxu release

Debian is the Internet spontaneous organization, the closest to the original Linux. Ubuntu is the Debian distribution for graphical desktops.

Redhat is a version developed and distributed by Red Hat Corporation. is currently the most widely used Linux server system. CentOS is the Redhat company for the server star products, is now widely used.

The difference between package managers:

Rpm:

RHEL, Fedora, S.U.S.E, CentOS

Dpt:

Debian, Ubuntu


2. Describe the use format of the commands on the Linux system; Ifconfig, Echo, TTY, STARTX, export, pwd, history, shutdown, Poweroff, reboot, Hwclock, date are detailed

Ifconfig: Configure and view the IP address of the network card. ifconfig [option]

Ifconfig etho 192.168.0.1 netmask 255.255.255.0 (Configure IP address on eth0)

Ifconfig Etho up (to enable the network card) ifconfig eth0 down (disables the network card)

Echo: Displays text. echo [option][string]

-N Do not wrap in the last line

-e cancel backslash ECS escape

TTY: The name of the file used to display the terminal connection standard input device.

#tty

STARTX: From the command interface line into the graphical interface. (Used to start x Windows)

#startx

Export: Add modify to delete environment variable.

Syntax: Export [-FNP] [variable name]=[variable setting value]

-F: Represents the function name in [variable name].

-N: Deletes the specified variable. The variables are not actually deleted, but are not exported to the execution environment of the subsequent directives.

-P: Lists all the environment variables that the shell assigns to the program.

PWD: Displays the current working directory.

#pwd

History: Lists the historical commands that have been executed.

N: number that lists the most recent n-pen command list.

!! : Previous command

!#: Execute command with ordinal #

!ABC: Executes the first command that starts with ABC.

!$: Invokes the last parameter of the last command.

Shutdown: Shut down the machine

shutdown [OPTION] ... Time [MESSAGE]

shutdown [option]

-r:reroot

-h:halt (Power off)

HH how long after shutdown

Poweroff: Power off automatically after shutting down the system. It's reboot's soft link.

Reboot: Restart

-N: Restart the system, do not perform sync, do not write var/log/wtmp

-W: Do not restart, only add the corresponding record in var/log/wtmp.

-I: Before restarting, all network interfaces are closed to ensure that no network user is logged into the system during the system restart.

Hwclock: Hardware Clock

-S: System time synchronization hardware time

-W: Hardware time synchronization system time

Date: View and set the current system time.

Date[option] ... [+format] : Displays

Date default format: Month day year. seconds

DATE:[MMDDHHMM[[CC][YY][SS]]

MM: Monthly

DD: what date

hh: Hours

mm: minutes

YY: two-digit year

CCYY: four-bit year

. SS: Seconds


3, how to get the Help information of the command on the Linux system, please detailed list, and describe how the chapter of the man document is divided

There are two types of help for getting commands on Linux, and if the shell comes with commands, you can use the Help [command] or man [command] for assistance.

If it is not the Shell's own command, you can use the man [command] or [command]--help to get help

Man Chapter: Paragraph descriptions in the Help manual:

NAME

Synopsis (outline, overview)

DESCRIPTION (description)

Options (optional)

EXAMPLES (example)

AUTHOR

REPORTING BUGS

See ALSO

Where the various types of commands exist:

Man1: User Commands

Man2: System call

MAN3:C Library Call

MAN4: Equipment files and special files

MAN5: Configuration file format

Man6: Games

MAN7: Miscellaneous

MAN8: Commands for managing classes

4. What are the file management commands on Linux, their commonly used methods and their related examples?

File management commands are: Cat more less (view file contents)

Nano Vim (edit file contents)

cat/etc/passwd

Touch (Create File)

Touch file name

CP (File copy)

-I: Interactive

-R: Recursively replicate directories and all internal content

-F: Mandatory

CP [option]/etc/passwd/tmp

RM (delete files)

-I: Interactive

-R: Recursively replicate directories and all internal content

-F: Mandatory

RM [option]/tmp/passwd

MV (moving files)

-I: Interactive

-R: Recursive

-F Mandatory

MV [option]/etc/shadow/tmp

5. Bash's work characteristics the command execution status return value and command line expansion are involved in the content and its sample demonstration.

After the command executes there is a return value that can be used with echo $? To view the return value if the return value is 0, the command execution succeeds, and if the return value is 1-255, the execution fails.

[Email protected] ~]# cat/etc/passwd &>/dev/null

[[email protected] ~]# echo $?

0

[Email protected] ~]# cat/etc/passeeewd &>/dev/null

[[email protected] ~]# echo $?

1

Command line expansion

~: Expand to the user's home directory

~username: Expand the home directory for the specified user

{}: Can host a comma-delimited list and expand it to multiple paths

/tmp/{a,b} =/tmp/a,/tmp/b

[[email protected] tmp]# mkdir a{d,e}

[[email protected] tmp]# ls

Ad AE

6. Use the command line expansion function to complete the following exercises:

(1), create/tmp directory: A_c, A_d, B_c, B_d

# mkdir {A,b}_{c,_d}

(2), create the/tmp/mylinux directory:

mylinux/

├──bin

├──boot

│└──grub

├──dev

├──etc

│├──rc.d

││└──init.d

│└──sysconfig

│└──network-scripts

├──lib

│└──modules

├──lib64

├──proc

├──sbin

├──sys

├──tmp

├──usr

│└──local

│├──bin

│└──sbin

└──var

├──lock

├──log

└──run

Mkdir/tmp/mylinux/{bin,boot,dev,etc,lib,lib64,proc,sbin,sys,tmp,usr,var,lock,log,run}


Mkdir-p/tmp/mylinux/grub/tmp/mylinux/rc.d/init.d/tmp/mylinux/sysconfig/network-scripts


Mkdir-p/tmp/mylinux/lib/modules/tmp/mylinux/usr/local/{bin,sbin}


7, what is the metadata information of the file, what does it mean, how to view it? How to modify timestamp information for a file.

Metadata information such as access rights, file owner and file data block distribution information, Inode, and file modification time, access time, change time.

Specific meaning

Access time: Time for accessing the file, using files such as cat, to view the command.

Modify time: Time to modify, edit the contents of the file, and the properties.

Change time: Changing times, ctime, meta data changes

View the metadata for a file: Stat file path

command to modify the timestamp of a file touch

-A: Change the file access time to the current system time

-M: Change the file modification time to the current system time

-T: Set the access time and modification time of the file yourself.

8. Display all files or directories in the/var directory that start with L, end with a lowercase letter, and have at least one digit (can have other characters) appear in the middle.

ls/var/l*[[:d Igit:]]*[[:lower:]]

9. Displays files or directories that start with any number in the/etc directory and end with a non-numeric number.

ls/etc/[[:d igit:]]*[^[:d igit:]]

10, Show/etc directory, start with a non-letter, followed by a letter and any other arbitrary length of any character file or directory.

ls/etc/[^[:alpha:]][[:d igit:]]*

11. In the/tmp directory, create a file that starts with Tfile, followed by the current date and time, with a filename such as: tfile-2016-09-20-09-32-22.

touch/tmp/tfile-$ (Date +%y-%m-%d-%h-%m-%s)

12. Copy all files or directories ending with. D in the/etc directory into the/tmp/mytest2 directory.

Mkdir/tmp/mytest2

Cp-r/etc/*.d/tmp/mytest2

13. Copy all files in the/etc/directory that begin with L or M or N and end with. conf to the/TMP/MYTEST3 directory

Mkdir/tmp/mytest3

Cp/etc/{l,m,n}*.conf/tmp/mytest3







This article from "Life endless toss to the end" blog, declined reprint!

Linux Basics Review One

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.