Benet2.0 _ s1_linux course command for v1.1

Source: Internet
Author: User
Benet2.0 _ s1_linux course command to sort out v1.1-general Linux technology-Linux technology and application information. The following is a detailed description. Benet2.0 _ s1_linux course command for v1.1
This version was modified by instructor Xu (Benet2.0 _ s1_linux course command for v1.1) to comply with the GPL protocol! Please indicate the source of the post! 3ks!
Author: Antiy7
Modify: laruence
Chapter 2 system introduction and Installation
I will not sort out the Forum materials.
Common commands and account management:
Objectives of this chapter:
Control linux Command formats and Command help
Control file and directory operation commands
Commands for mounting external storage devices
Understand the setting files of users and groups
Manage users and groups in linux
2.1 command Overview
Command Format:
Common Format of Linux commands:
Command [Command Options] [command parameters]
Note: The following command is interpreted as the result after you press enter on the command line interface.
Get Command help:
1. help Command
Shell commands are considered as internal commands. in linux, only a few commands are shell commands.
$ Help displays the list of shells included in bash.
$ Help xxx displays the help information of a command
$ Help? S xxx only displays the format of a command
2. Use the "--help" Command Option
3. Man xxx reads the manual page of a command in full screen mode, and the Q key exits.
4. Info xxx provides a man-like function to display the help information of a command, and the Q key exits.
2.2 Common commands
File and directory operation commands:
Directory operation command:
$ Ls: List directories.
$ Ls-l list detailed directory information.
$ Ls-a lists hidden file directories.
$ Ls-l xxx lists detailed information about an independent directory.
$ Pwd: displays the current directory.
$ Cd to the Home Directory
$ Cd .. the parent directory of the current directory is returned from the current directory, that is, it is returned to the upper-level directory.
$ Cd/directly go to the root directory.
$ Cd/home use the absolute path to enter the/home directory.
$ Cd ../home use the relative path to enter the/home directory.
$ Mkdir xxx creates a directory.
$ Mkdir xxx yyy zzz creates multiple directories at a time.
$ Rmdir xxx specifies to delete a directory. (The directory must be empty)
$ Rmdir xxx yyy zzz: delete multiple directories at a time. (The directory must be empty)

File Operation command:
Command for viewing file types:
$ File/bin/ls: view the ls file type in the bin directory.
Run the following command to create a file:
$ Touch xxx creates a file.
Copy FILE command:
$ Cp xxx yyy copies the file xxx to yyy, which is equivalent to saving as in windows.
$ Cp xxx yyy AAA: copy the xxx yyy file to the AAA directory.
$ Cp-r aaa bbb: copy the AAA directory to the BBB directory.
Command to delete a file:
$ Rm xxx deletes an object.
$ Rm xxx yyy zzz Delete multiple files at the same time.
$ Rm? R AAA deletes non-empty directory AAA. Confirm.
$ Rm? Rf AAA deletes non-empty directory AAA. No need to confirm.
$ Rm-rf * Delete all files and directories in this directory. No need to confirm. (Use with caution)
File movement and rename:
$ Mv xxx yyy moves xxx to yyy, which is equivalent to renaming.
$ Mv xxx yyy AAA cut xxx yyy to the AAA directory.
File Search command:
$ Find shows all files in the current directory.
$ Find [path...] [Expression]
$ Find-name xxx searches for a file name.
$ Find-uid N: the user's uid number. N is the user's uid number.
$ Find-type X is used to search for files. X indicates five file types. That is, find-type f indicates searching for common files.
Command for viewing text files:
$ Cat/etc/passwd: view the passwd text file under the etc directory.
Note: cat does not pause when displaying text files. It only displays the last file content. Therefore, the cat command is not suitable for viewing long files.
$ More/etc/passwd: view the passwd text file under the etc directory.
Note: more displays the text file content on a split screen and waits for the remaining content to be displayed by pressing the user button.
Enter a space to display the content of the next screen.
Enter B to display the content of the previous screen.
Press enter to display the next line.
Enter Q or q to exit the current more command reading environment.
$ Less/etc/passwd view the passwd text file under etc.
Note: The less command provides some extensions for the more command, which is more suitable for reading larger text files.
Enter page up and page down to flip pages.
Other operations are the same as those of more.
$ Head/etc/passwd: display the file header. If no option is used, 10 lines of content are displayed by default.
$ Tail/etc/passwd: display the end Of the file. If no option is used, 10 lines of content are displayed by default.
Use a CD and a USB flash drive:
How to Use the CD:
1. The device file of the CD
$ Ls? L/dev/cdrom: displays the detailed content in the cdrom directory under the dev directory. Used to determine the optical drive location.
2. Disk mounting command format:
$ Mount? T type dev dir
CD: iso9660/dev/cdrom/media/cdrom
$ Mount/dev/cdrom/media/cdrom mount the optical drive to the cdrom under the media directory.
3. Read the content of the CD (either of the two Commands)
$ Ls/media/cdrom reads the content of the mounted disc.
4. unmount the CD
$ Umount/dev/cdrom Drive unmounted.
$ Umount/media/cdrom Drive unmounted.
5. Pop-up and recovery of the disc drive Tray
$ Eject: the optical drive is displayed.
$ Eject? T reclaim the optical drive.
6. Create a CD image file
# Cp/dev/cdrom rhel4-1.iso
7. Attach and detach a CD image file
# Mount? O loop-t iso9660 rhel4-1.iso/media/cdrom
# Umount/media/cdrom
USB flash drive usage:
1. USB flash disk Recognition
$ Fdisk? L
2. Mount and use a USB flash drive
$ Mount? T vfat/dev/sda1/mnt/
$ Mount? T ntfs/dev/sda1/mnt/
3. unmount the USB flash drive
$ Umount/dev/sda1
2.3 user and group management commands
User Management
1. User account files
/Etc/passwd
2. shadow
/Etc/shadow
3. Add a user
$ Adduser
4. Use the passwd command to set the user password.
5. delete a user
$ Userdel [-r] name
6. Modify user attributes
$ Usemod [-L] name
$ Usermod [-U] name
$ Usermod [-e] YYYY-MM-DD name
7. modify a user Template
/Etc/skel

User Group Management
Add User Group
User Group file:
$/Etc/group
Add User Group:
$ Groupadd groupname
Specify a user group when creating a user
$ Adduser [-g group] name
Delete User Group
$ Groupdel group
Change a user's group account
$ Usermod [-g group] name
File Permission settings
View File Permissions:
$ Ls? L
Change file permissions:
$ Chmod [ugoa…] [+-=] [Rwx] file ......
Change the owner and group of the file:
Chown OWNER: [: [GROUP] FILE
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.