Linux basic Commands (i)

Source: Internet
Author: User

Symbolic Linksln-s ~/projiect/haha/link1//Create in current directoryA symbolic link to the ~/projiect/haha directory, and the operation of the file under the Link1 directory is the operation of the file in the Projiect directoryRM Link1 Delete the link, butThe contents of the ~/projiect/haha/directory do not change RM - R link1/ Projiect/haha under the file Delete link Link1 is not deleted, display: Cannot delete "link": Not the directoryln-s ~/projiect/haha Create a symbolic link named haha in the current directory, haha point to the ~/prijiect/haha directory  usage of CPCp-r (recursively replicates the directory.) Used in catalogs with subdirectories)-F (if there is a target file that cannot be opened, try removing it before attempting)-A (to copy a directory completely, maintaining soft and hard links and file attributes, equivalent to specifying-BPR at the same time)-P (preserves the properties of the source file or directory)-I (ask the user before overwriting the file)CP txt txt1 assignment txt to txt1, txt1 not exist then created, existing overwriteCP-A A1 A2 A2 does not exist then new, content in A1 is copied to a2;a2 exists then A1 copied to A2 directory,Overwrite if a file with the same name exists under A2  Files and directoriesTree (lstree) displays files and directories starting with the root directoryFile txt identification files Type stat txt view file atime (acess access Time), Mtime (Modify modified time), CTime (change state time)Touch txt creates an empty fileTouch txt update file txt time with LS--full-time txt view file creation timetouch-t 0712250000 txt modified TXT file was created at 2007-12-25 00-00-00mkdir-p Creating a directory treemkdir-m User Management/etc/passwd defines the properties of each user account/etc/shadow The user password to save ciphertext, only the administrator can read/etc/group saving information for a user group/etc/login.defs/etc/default/useradd uses these two default account settings files to implement the user's basic settings when creating a user useradd test New user test creates a user group with the same name as the user nameuseradd-g students test1 Creating a test1 user, belonging to the students group, does not create a group with the same name as the user nameusermod-g Students test (modify user properties) change user group, change test from default test group to students group//Add existing users to other groups, one user can belong to more than one group at a timeUSERMOD-G Training test adds the test user to the Trainnig group, and the test belongs to both the students and trainning groupsor add test to trainning using the gpasswd-a test trainninguserdel-r Test Delete user and user's host directory (-r exclude home directory)passwd test ROOT to set a password for the user, even 2 times the passwordpasswd Login User test, the user changes the password, enter the original password to enter a new passwordchage-e 2005-12-31 user1 setting the expiration period for user passwordsPwck checking the file format and syntax corrections of '/etc/passwd ' and the presence of the user
GRPCK checking the file format and syntax corrections of '/etc/passwd ' and the presence of groups
newgrp group_name Log in to a new group to change the preset group of newly created files groupadd-g 888 Students create a user group with GID 888Groupdel GroupName Delete a user group, remove or remove users from that group firstgroups test to see which group the test user belongs toTo Modify the group name and user name:groupmod-n newname oldnameusermod-l newname oldname file types and Permissions<1> file type: "-Normal File d directory B block device file (hard disk drive/dev/sda* sr0) c character device file (/dev/ttys*) L symbol link file p is a pipeline files (socket file)sudo mknod-m 660 SDB4 B 8 5//Create block device file, main device number 8, secondary device number 5<2> file permissions: (Usage of chmod)chmod a+x Hello//Add owner, all groups and other users ' executable permissions//u (file owner) g (all groups of files) O (other users) a (all three) + (add permission)-(Cancel permission) = (unique setting permission)//r (Read) w (write) x (execute) s (set user or group ID number) T (set sticky bit sticky bit to prevent file or directory from being deleted by non-owner)chmod-r A+r *//Set All files and subdirectories in the current directory to be readable by anyone (-R can traverse from directory recursively)chmod a=rwx file or chmod 777 file//modify file Three are readable, writable, executablechmod u+s Hello//Set the SUID setting bit for Hello, the user who runs the file is also given the same permissions as the ownerchmod g+s Hello//settings sgid set bit, similar to Suidchmod o+t projiect/set the STIKY bit of a file -allow only legitimate owners to delete files Find/-perm-u+s lists all files in a system that use suid control <3>suid,sgid and stiky setting bits

-rwsr-xr-x indicates that the executable bit is set in Suid and owner permissions

-rwsr--r--indicates that suid is set, but the executable bit in the owner's permission is not set

-RWXRWXRWT indicates that the STIKY bit and other executable bits are set

<3> file attributes (Chown chgrp)

Chown user1 File1 Change the Owner property of a file
Chown-r User1 Directory1 Change the owner property of a directory and change the properties of all files in the directory at the same time
Chown user1:group1 File1 Changing the owner and group Properties of a file
chgrp group1 file1 changing a group of files TimeThe system time is from RTC (real clock), RTC Time is the number of seconds since 1970-1-1 00-00-00 hwclock-r option to display the current RTC time hwclock-s option to use the current RTC Time is initialized to Linux system time; the HWCLOCK-W option is used to write the current Linux system time to the RTC time; date Displays the system dateCal 2007 Displays the 2007 Calendar tableDate 041217002007.00 sets the day and time of day-the year of the month. seconds
Clock-w saving time changes to the BIOS system shutdown and restart loginShutdown-h Nowshutdown-h hours:minutes & Shutdown system at scheduled times
Shutdown-c Cancel the system at a predetermined time
Shutdown-r Now/Reboot restartLogout LogoffWHOAMI displays the currently logged on user change the Run level<1> Restart entry runlevel: sudo vim/etc/inittab change the number after ID<2>sudo Init 5  Add sudo account#vim/etc/sudoersZhoutian all= (All) all (or Nopasswd:all)

Linux basic Commands (i)

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.