File and folder operation commands in Linux VPS

Source: Internet
Author: User
Tags gz file mkdir parent directory vps


File and directory operations:

Go to a directory: cd/directory Name

Return to Parent directory: CD ...

Return to upper Parent directory: CD. /..

Delete File: RM filename

Delete directory: RmDir directory name

Move or rename a file: MV Old path New path

Copy file: The new file path to which the CP source file path is copied

Lookup file: Find file name

View files in directory: LS directory name

Change Site Folder directory owner

Chown-r www site

File Decompression operation

tar.gz Compression and decompression

Decompression filename.tar.gz
Tar zxvf filename.tar.gz

Extract filename.tar.gz to Site Directory
Tar zxvf filename.tar.gz Site

Compress Site Directory for filename.tar.gz
TAR-ZCVF filename.tar.gz Site

Compress multiple directories (site1 site2) to filename.tar.gz
TAR-ZCVF filename.tar.gz Site Site1 site2

Zip compression and decompression
Decompression Filename.zip
Unzip Filename.zip

Extract Filename.zip to Site Directory
Unzip Filename.zip site

Delete operation

Create a demo folder with permission 755
mkdir 755 Demo

-R is recursive down, no matter how many levels of directory, delete
-F is simply forced to delete, without any hint of the meaning

Llinux do not have a recycle Bin, use RM-RF must be extra careful

Delete the/home/site/folder (the directory and all the files and folders under it)
rm-rf/home/site/

Delete filename.tar.gz file
Rm-f filename.tar.gz


Here is a description of Linux statistics directory/folder size command: Du
If you want to see the size of each subdirectory under the current directory:


Du-sh./*

Get the following echo:
root@vm:/var# du-sh./*
424K./backups
8.2M./cache
50M./lib
4.0K./local
8.0K./lock
14M./log
4.0K./mail
4.0K./opt
96K./run
60K./spool
4.0K./tmp
8.0K./www


The above results show that the Lib directory occupies 50M of disk space, followed by log directory, Occupy 14M space;
If the disk has multiple partitions and you want to see how each partition is used, use the DF command:

Df-hl


are shown as follows:

/DEV/SDA1 16G 662M 15G 5%/
Tmpfs 252M 0 252M 0%/LIB/INIT/RW
Udev 247M 124K 247M 1%/dev
Tmpfs 252M 0 252M 0%/dev/shm
Description SDA1 Disk total 15G, using 662M, only 5%


And then attach some functions

Basic file and directory operations
The commands are: Cat, Chgrp, Xgnod, C
Hown, clear, CMP, CP, Cut,
Diff, Du, Emacs, F
mkdir, Mikdir, more,
grep, file, FMC, grep, H
EAD, LN, less, locate, LS,
MV, Pico, PWD, RM
, Whatis, Whereis
, sort, stat, strings, t
AIL, touchy umask, UMQ, VI, WC

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.