Common Linux shell commands

Source: Internet
Author: User

Recently, vmserver was deployed to facilitate management of hosted servers. The db server is intended to be deployed in linux. Currently, Ubuntu is used. After the server version is installed, the system is dumb-eyed and full-command-line... So let's start to collect useful commands. Let's make a memo here.

1. Force uninstall and install the NIC to forcibly obtain ip addresses from dhcp

Sudo ifdown eth0

Sudo ifup eth0

(Similar to sudo dhclient-r, it seems that the current usage has not taken effect. I will try again later .)

2. Shutdown and restart

Sudo shutdown-p 0 shut down and power off after 0 seconds

Sudo shutdown-r 0 shut down and restart after 0 seconds

3. Set static IP address for ubuntu server

$ Sudo vi/etc/network/interfaces edit the IP settings file

------------------------------------------------- Split line ------------------------------------------------

# This file describes the network interfaces available on your system

# And how to activate them. For more information, see interfaces (5 ).

# The loopback network interface

Auto lo

Iface lo inet loopback

# This is a list of hotpluggable network interfaces.

# They will be activated automatically by the hotplug subsystem.

Mapping hotplug

Script grep

Map eth0

# The primary network interface

Auto eth0

Iface eth0 inet static

Address 192.168.0.100 # This is your IP

Netmask 255.255.255.0

Network 192.168.0.0

Broadcast 192.168.0.255

Gateway 192.168.0.1

------------------------------------------------- Split line ------------------------------------------------

Sudo/etc/init. d/networking restart network connection

4 Tib decompress tar.gz package

Tar-xzf does not print the decompression progress

Tar-xvzf: print the decompression progress

5. Move or rename a folder

Mv from

6. New users and user groups

Groupadd usergroup Add User Group

Useradd-r-g user usergroup add user to group

7. Change the owner and group of the folder (. indicates all files and folders)

Chown-R user.

Chgrp-R user.

8. Copy files

Cp from

9. Change the User Password

Passwd [username]

Others to be continued

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.