Linux basic commands

Source: Internet
Author: User

CD CD. Previous level CD-Previous CD ~ root directory

LS -a lists all files (including hidden files)-L lists details-s list file size-T sorted by time-a lists except. and. File-r file directory for all subdirectories listed in the-S file size sort

Netstat -a lists all listening ports-n rejects display aliases-p displays the program name and process number that establish the associated link-t only and TCP-only and UDP-related-l lists only the service status that is in Listen (listening)

-C executes the netstat command every other fixed time. -C executes the netstat command every other fixed time.

NETSTAT-ANP | grep LISTEN Displays all listening ports and process numbers

cat View text: Cat filename View entire file contents cat > FileName Create a new file, cannot edit an existing file cat file1 file2 > file merges two files into one file

vim enters text edit press ESC: Wq save and exit: Q exit: q! ignore changes and exit Shift + G: Move down SHIFT + E: Move up I: Enter edit mode

MV [move the file name or directory name] [mobile destination directory] Move

CP [file name or directory] [Mobile Destination Directory] Replication

Apt-get Apt-get Search package View related packages Apt-get Install package packages

Current directory where pwd is located

Grep

Example tar:

Extract

    • TAR–XVF File.tar Unpacking the TAR Package
    • TAR-XZVF file.tar.gz Decompression tar.gz
    • TAR-XJVF file.tar.bz2 Decompression tar.bz2
    • TAR–XZVF File.tar.z Unzip the tar. Z
    • Unrar e file.rar decompression rar
    • Unzip File.zip Unzip zip

Compression

    • TAR–CVF Jpg.tar *.jpg package All JPG files in the directory into tar.jpg
    • TAR–CZF jpg.tar.gz *.jpg package All JPG files in the directory into Jpg.tar and compress them in gzip to generate a gzip compressed package named jpg.tar.gz
    • TAR–CJF jpg.tar.bz2 *.jpg package All JPG files in the directory into Jpg.tar, and then compress them in bzip2 to generate a bzip2 compressed package named jpg.tar.bz2
    • TAR–CZF jpg.tar.z *.jpg package All JPG files in the directory into Jpg.tar, and then compress them in compress to generate a umcompress compressed package named Jpg.tar.z
    • RAR a jpg.rar *.jpg rar format compression, you need to download RAR for Linux first
    • Zip jpg.zip *.jpg zip format compression, you need to download the zip for Linux first

mkdir Creating a folder

RM Delete a file or folder

alias set don't kill alias = "Relative Command" Example: alias= "Ls-g", Ubuntu set permanent alias

Vim ~/.BASHRC Add to the file in the appropriate location

Ubuntu config environment variable : in/etc/environment file

Path= "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/share/ Zookeeper/bin/"

When adding the corresponding variable, in quotation marks Nega: Related directory

Configuring IP addresses and DNS

Open the/etc/network/interfaces file and modify the appropriate information. The static IP configuration is as follows

# The Primary network interface

Auto Enp3s0

Iface Enp3s0 inet Static

Address 192.168.172.109

Netmask 255.255.255.0

Gateway 192.168.172.1

Dns-nameservers 202.96.134.133

The DHCP configuration is as follows

# The Primary network interface

Auto Enp3s0

Iface ENP3S0 inet DHCP

Linux basic commands

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.