Linux basic commands

Source: Internet
Author: User

Linux basic commands

1. System Information

The processor architecture of the arch//display machine
UNAME-M//Display the processor architecture of the machine
Uname-r//Show the kernel version in use
UNAME-A//view kernel/operating system/CPU information

Cat/proc/cpuinfo//Display information for CPU info
Cat/proc/interrupts//Display Interrupt
Cat/proc/meminfo//Verify Memory usage
Cat/proc/swaps//show which swap is used
Cat/proc/version//display version of the kernel
Cat/proc/mounts//display of loaded file systems

Hostname//view computer name
LSPCI-TV//List all PCI devices
LSUSB-TV//List all USB devices
Lsmod//List loaded kernel modules
ENV//View environment variables

Date//Display system date
Cal 2014//Display 2014 calendar table

2. Files and directories

Cd/home//Enter '/home ' directory
Cd.. Return to the top level directory
Cd.. /.. Return to the top level two directory
CD ~user1//Enter the personal home directory, for example:/home/huxiusong/
CD-//Return to the last directory
PWD//Show work path
LS//view files in directory
Ls-f//Viewing files in a directory
LS-L//display details of files and directories
LS-A//Show hidden files

mkdir Dir1//Create a directory called ' Dir1 '
mkdir dir1 DIR2//Simultaneous creation of two directories
Mkdir-p/TMP/DIR1/DIR2//Create a directory tree

Rm-f file1//delete a file called File1
RmDir dir1//Delete a directory called Dir1
RM-RF Dir1//Delete a directory called Dir1 and delete its contents at the same time
RM-RF dir1 dir2//Delete two directories and their contents at the same time

MV Dir1 new_dir//rename/move a directory
CP file1 file2//Copy a file
CP dir/*. Copy all files under a directory to the current working directory
Cp-a/tmp/dir1. Copy a working directory to the current working directory
Cp-a dir1 dir2//Copy a directory

MV file1/usr/local/servers/fddseller///moving files

Ln-s file1 LNK1//Create a soft link to a file or directory
ln file1 LNK1//Create a physical link to a file or directory

3. File Search

Find/-name file1//Enter root file system to search for files and directories from '/'
Find/-user user1//Search for files and directories belonging to user ' User1 '
Find/usr/bin-type f-atime +100//Search for execution files that have not been used in the last 100 days
Find/usr/bin-type f-mtime-10//search for files created or modified within 10 days

4. Disk space

FREE-M//view memory usage and swap area usage
Df-h//Displays a list of the partitions that have already been mounted
Du-sh < directory name >//View the size of the specified directory
grep memtotal/proc/meminfo//View total memory
grep memfree/proc/meminfo//View idle memory
Uptime//view system uptime, number of users, load

CAT/PROC/LOADAVG//View system load
LS-LSR |more//Arrange files and directories in size
Mount |column-t//view the status of the attached partition
Fdisk-l//View all swap partitions

5. Permissions for files

chmod ugo+rwx dir//Set the directory owner U, Group G and others o to read R, write W and execute x permissions
chmod go-rwx dir//delete Group G and others o Read and write execution permissions on the directory
Chown user1 file1//Change the Owner property of a file
Chown-r user1 Dir1//Change the Owner property of a directory and change the properties of all files in that directory at the same time
Chown group1 file1//change a file group
Chown user1:group1 file1//Change the owner and group properties of a file
chmod +x *.sh//Set Execute permissions on *.sh file, +x

6. Process Network

Ifconfig//View the properties of all network interfaces
Iptables-l//View firewall settings
Route-n//View route table
Kill-9 PID//Kill process PID
NETSTAT-LNTP//View all listening ports
NETSTAT-S//View network statistics
NETSTAT-ANP | grep PID//Display Network port information
NETSTAT-ANP | grep port//test port port is in listening processing
Ps-ef|grep Java//list Java process PID
Top//real-time display of process status

Reference article:
Http://www.oschina.net/translate/useful-linux-commands-for-newbies
Http://www.php100.com/html/webkaifa/Linux/2009/1106/3485.html

Set the Ubuntu network IP address, set the file address to:
/etc/network/interfaces
Once setup is complete, Ifdown eth0/ifup eth0, then view ifconfig

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.