Linux First principle: must first back up the files to be modified
2012-05-24 (learning)
Recent books and the chaos, mainly to prepare, delete files, systems, sub-district of the related problems:
DD IF=/DEV/SDX OF=/DEV/SDX #將分區x完全複製到X
(Tip: DD is a copy of the block, so the time it takes to determine the size of the subregion, rather than the number of numbers in the subregion.)
The normal rate of copying is 30~60m/sec. 1G usually takes about 30 seconds)
The function of the CP command is to copy the given file or directory to another file or directory, which is very powerful.
Syntax: CP [option] source file or directory destination file or directory
Note: This command copies the specified source files to the destination file or copies multiple source files to the destination directory.
The options for this command have the following meanings:
-A This option is typically used when copying a directory. As far as possible, the file status, permissions and other information are reproduced as original.
-Keep links when copying D.
-F If a destination already has a file with the same file name, it should be deleted before copying and not prompted.
-I and F options, in contrast, will prompt the user for confirmation before overwriting the target file. Answer y when the target file will be overwritten, is an interactive copy.
-P At this point, the CP will also copy the modified time and access rights to the new file in addition to the contents of the source file.
-R If the source file is a directory file, the CP will recursively replicate all subdirectories and files in that directory to the destination. The destination file must be a directory name at this time.
-L do not make copies, just link files.
To prevent users from inadvertently using the CP command to destroy another file, such as the user specified target file name already exists, with the CP command to copy the file, the file will be overwritten by the Xinyuan file. It is recommended that users use the I option when copying files using the CP command.
Example:
$ cp-i test1.c/usr/cpp/test2.c
This command copies the file test1.c to the/usr/cpp directory and renames it to test2.c.
If you do not want to rename it, you can use the following command:
$ CP test1.c/usr/cpp/
Copy all log files to the BAK subdirectory:
$ cp *.log Bak
2012-05-23 (learning),
Create and delete user command questions
sudo useradd kevin-m-d/home/kevind #建立新用戶kevin, compelling to create a home record under///Kevind
sudo passwd Kevin #為用戶kevin建立新的密碼
sudo userdel Kevin #刪除用戶kevin
sudo rm/home/kevind-r #強制刪除目錄kevinD #-R Please be cautious before use
View User Details
Finger Kevin #可以查看主機用戶資料, it's dangerous.
Lock and unlock your user
Passwd-l Kevin #鎖定用戶kevin
Passwd-u Kevin #解鎖用戶kevin
Switch to user identity as another user
Su-l Kevin #將當前用戶更換為kevin, this time prompted to enter the password (is Kevin's password), in the chmod is very convenient to set the file
User Identity editor that can execute sudo commands
sudo visudo #用於編輯/etc/sudoers
2012-05-20 (learning)
sudo apt-get install software name installation software command
sudo nautilus Open file (with root permission)
SU root switches to "root"
LS lists the current directory file (excluding hidden files)
Ls-a list current directory files (including hidden files)
Ls-l list the files in the current directory for more information
Cd.. Back to the top-level directory of the current directory
CD-Back to the same directory
CD ~ or CD back to the current user's host directory
mkdir directory name Create a directory
RmDir Empty directory name Delete an empty directory
RM FileName File name Delete a file or multiple files
RM-RF non-empty directory name delete everything under a non-empty directory
MV Path/Document/warp/file movement relative to the path of the file to the absolute path
MV FileName New name renamed in current directory
Find Road via-name "string" finds paths in the range of files and directories that meet string matches
Fdisk fdisk-l viewing system partition information
FDISK FDISK/DEV/SDB partition a new SCSI hard drive
Chown chown Root/home Change the owner of/home to the root user
CHGRP chgrp root/home Change the home/home group to the root group
Useradd Create a new user
Groupadd group name to create a new group
passwd user name create password for user
passwd-d User name Delete user password can also login
Passwd-s User name Inquiry account password
Usermod-l new username old user name renamed to User
Userdel–r User name Delete user everything
TAR-C Create Package –x release Package-v Display command procedure –z represents a compressed package
TAR–CVF benet.tar/home/benet Pack The/home/benet directory
TAR–ZCVF BENET.TAR.GZ/MNT Package and compress the directory
TAR–ZXVF benet.tar.gz Compressed Package file decompression and recovery
TAR–JXVF benet.tar.bz2 Decompression
Make compilation
Make install installs the compiled source package
Reboot Init 6 Restart Linux system
Halt Init 0 shutdown–h now shut down the Linux system
Uname-a Viewing the kernel version
Cat/etc/issue View Ubuntu version
LSUSB Viewing USB devices
sudo ethtool eth0 view NIC status
Cat/proc/cpuinfo Viewing CPU information
LSHW Viewing current hardware information
sudo fdisk-l viewing disk information
Df-h viewing the remaining space on the hard disk
Free-m View Current Memory usage
PS-A See which processes are currently in progress
Kill process Number (the number of the first column in ps-a) or killall process name (kills a process)
Kill-9 process number forces a process to be killed
Common APT Commands:
Apt-cache Search Package
Apt-cache Show package for information about packages, such as description, size, version, etc.
sudo apt-get install package
sudo apt-get Install package--Reinstall reinstall packages
sudo apt-get-f install fix "-F =–fix-missing"
sudo apt-get Remove Package
sudo apt-get Remove Package--purge delete packages, including deletion of configuration files, etc.
sudo apt-get update source
sudo apt-get upgrade update installed packages
sudo apt-get Dist-upgrade upgrade system
sudo apt-get dselect-upgrade using Dselect upgrade
Apt-cache depends package learn about using dependencies
Apt-cache Rdepends package is to see which packages are dependent on
sudo apt-get BUILD-DEP Package Installation-related compilation environment
Apt-get Source Package Downloads The source code for the bundle
sudo apt-get clean && sudo apt-get autoclean cleanup of useless packages
sudo apt-get check to see if there is a corrupted dependency
Clean up all software caches (that is, the Deb packets that are cached in the/var/cache/apt/archives directory)
sudo apt-get clean
Remove orphaned software that is no longer used by the system
sudo apt-get autoremove
1. Division:/boot;
2.date # Date
Cal # when month calendar
Cal 1972 # The calendar of the year
Cal 7 1072 # when the calendar of the month
BC # Calculator (scale=3 #精確到小數點后3位)
ca [tab] [tab] # Show all instructions for CA opening (instructions)
The man command # explains what you want to borrow from the command.
sudo apt-get install Manpages-zh # installation Chinese version of Man
FSCK # Check and repair Linux file system
CD Change Catalogue
.. When the previous catalogue
. Previous entries
-Previous Job recording
~ Home Catalogue
PWD shows your current catalog
mkdir Create a new catalog-p to create a multi-level directory
RmDir Delete (empty) catalog-p to remove multi-level catalogs
LS View Archives and catalogue
CP Duplicate
RM move
MV Erase
chmod commands to control the reading, writing, and licensing of folders and files
Linux files have access rights in Tier 3: File holders + groups + others
R Read = 4
W Write write = 2
X Perform xactive = 1
Full Rights rwx = 7
Read rights rw-= 6
Only r-x = 5
In this case, the file's rights are: R+w+x r+w+x r+w+x
Example: 4+2+1 4+2+1 4+2+1 = 777: (File ownership + Group + other) has full rights to the file
4+2+1 0+0+0 0+0+0 = 700 means: Only (the files have) have full rights to the file
4+2+1 4+2+1 0+0+0 = 770 means: Only (Files with the group) have full rights to the file
Common rights are 600 644 700 755 711 666 777,666 and 777 are undesirable practices.
Chown is the root that can be used to change the person who owns the file.
Command line: Chown New archives: Group Archives
Example: Chown kevin/home/abc says: Only Kevin is the one who owns the home file ABC.
Chown Kevin:admin/home/abc says: Kevin and admin Group are all of the home under the ABC of the Holders
-R is the order to be handed over to all the files under the file
Linux command line