Old boy Education-linux-pen question-1

Source: Internet
Author: User

2. Pen question-1

2.1 Create a new user, the password is 123456, and add it to the root group

Useradd user-g root && echo "123456" |passwd--stdin user

2.2 Displays the date and time of the current system

[[Email protected]/]# date +%f2016-08-25[[email protected]/]# date +%x10 16 minutes 25 seconds [[email protected]/]# date +%h:%m:%s10:1 7:45

2.3 How to view the Help file for command sort

Mans Sortsort--help

2.4 Split screen Show commands for/etc/services files

Less/etc/services

2.5 Viewing host routes

Route-nnetstat-r

2.6 Packaging and compressing/etc directory

Cd/tar zcf/tmp/etc.tar.gz./etc# authentication [[email protected]/]# ll-h/tmp/etc.tar.gz-rw-r--r--1 root root 9.3M 2016-08-25 10 : 07/tmp/etc.tar.gz[[email protected]/]# du-h/tmp/etc.tar.gz9.3m/tmp/etc.tar.gz

2.7 Restart the Samba service command

/etc/init.d/samba Restartservice Samba Restart

2.8 Viewing process status

There are 5 states of processes on Linux:

1. Running

2. Interrupt (in hibernation)

3. Non-disruptive

4. Zombie

5. Stop


PS Tool identifies 5 status codes for the process:

D non-interruptible uninterruptible sleep (usually IO)

R run runnable (on run queue)

S Interrupt Sleeping

T stop traced or stopped

Z Zombie a defunct ("zombie") process

[[email protected] ~]# ps aux |head -5    user         pid %cpu %mem    vsz   rss  TTY      STAT START   TIME COMMANDroot           1  0.0  0.1  19232   1516 ?        Ss   Aug24    0:01 /sbin/initroot          2  0.0   0.0      0     0 ?         S    Aug24   0:00 [kthreadd]root           3  0.0  0.0       0     0 ?        s    aug24    0:00 [migration/0]root          4  0.0   0.0      0     0 ?         S    AUG24   0:00 [KSOFTIRQD/0]

2.9 Set the new file permission to 600

chmod NewFile

2.10 Copy file/etc/group to user home directory, file name is unchanged

Cp-p/etc/group ~cp-a/etc/group ~-a-pdr-p same as--preserve=mode,ownership,timestamps-d same as--no-dere Ference--preserve=links-r Copy Directories recursively

2.11 Commands to restart the Linux server

Rebootinit 6shutdown-r Now

2.12 How to view processes that occupy 8080 ports

Lsof-i: 8080NETSTAT-TUNLP |grep 8080


2.13 How to change IP, host name, DNS

1. Modify IP and DNS

    • Setup graphical tools

    • Modify configuration File "/etc/sysconfig/network-scripts/ifcfg-eth0"

2. Modify Host Name

Hostname Host name # Temporary effective Vim/etc/sysconfig/network # permanent hostname= hostname


This article is from the "Chen was 007" blog, please be sure to keep this source http://chenfage.blog.51cto.com/8804946/1842322

Old boy Education-linux-pen question-1

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.