copy files and index
cp file_name file_name_copy
cp -r files files_copy
cp -rv files files_copy # you can see the process
move , rename file or index
mv file directory/
mv file directory/renamed file
mv file renamed_file # rename
remove
rm file
rm -r directory
rm -ri directory #will remind you every time you remove a file
# -f :force to remove without any reminding.
create or remove a index
mkdir directory
rmdir directory # remove but only empty directory
tree structure of linux index
bin
executable binary files , all users have the right to run
boot
the core exists in it
dev
it is short for device.
All the devices are illustrated as a file.
etc
In general, all the relative settings exists in it.
home
Store the user's private stuff.
root
The administrator 's files.
mnt
Mount index
opt
install large software.
proc
intermediate information, virtually. Only exists in the hardware.
sbin
executable files but only can be ran by super user.
sys
low level hardware information.
tmp
temporary files. such as zip, tar and etc...
usr
applications are generally installed in it.
var
information always vary. Such as log,mails.
frequent commend lines
date and time
date
date -u
# format show
date +%Y--%m--%d
hwclock #hardware time
cal
uptime
output and investigate command
echo # return the information you put in
cat file # investigate the file's information
more file# turn the page only down
less file # turn the page up and down #'q' can quit.
head #show the head, default 10 lines.
head -3 # show the first 3 lines
tail # show the tail,default 10 lines
tail -f # you can see the latest updates.
see the hardware information
lspci # see the PCI device
lsusb # see the USB device
-v # you can see more details about those devices
lsmod # see all the modules(drivers)
shutdown and restart
shutdown
-h #shutdown
-r #restart
such as:
shutdown -h now # shutdown right now
poweroff #shutdown right now
shutdown -h +10 #shutdown after 10 minutes
shutdown -h 23:30 #shutdown at 23:30
reboot # restart right now
zip and tar
要弄清两个概念:打包(tar)和压缩(zip)。打包是指将一大堆文件或目录变成一个总的文件;压缩则是将一个大的文件通过一些压缩算法变成一个小文件。
zip file_name_after_zip.zip myfile #compress the file
unzip file.zip #uncompress the file
gzip file_to_compress
tar -cvf tarName.tar file # gui dang
tar -xvf file # release the tar file
tar -cvzf tar&compressName file #plus -z tar and compress at the same time, call the gzip
find
locate keyword # needs a database, default refresh one time a day
# use updatedb,you can update the db immediately.
find position parameters
find . -name *keyword*
find / -name *keyword*
find / -name *.conf
find / -perm 777 # the belonging right is 777
find / -type d # d represents all the index
find . -name "a*" -exec ls -l {} \; #find the files and pass them as parameters to run the following command
other find conditions
-name
-perm
-user
-group
-ctime
-type
-size