Linux user administrative rights to manage memory management network management commands (the fourth day)

The group of users added by default and will automatically add the same user name
su switch user
user to view the current login: whoami id`
view the current user belongs to which group: Groups
groupadd group name to add group
groupdel group name Delete group
grep test / etc / group Looking at the group test file inside
adm (group name): x (password): 4 (group id): syslog, liujizhou (inside the user group)

Adding users to the test group pentest
gpasswd -a pentest test
will be removed from the test group pentest
gpasswd -d pentest test

-u 5000 -g -G demogroup the useradd the root -d / Home / -s Demo / bin / the bash Demo
the useradd parameter
-u specifies the UID
-g specified group
-G specified user additional groups
-d specified (home directory home directory, home directory, the default directory)
-s develop parser
-o -u general use and at the same time, create the same user ID and other user

Modify user: usermod
parameters: -l modify the user name usermod -l username change the original name of the user
-d home directory usermod modify the original family home directory -d directory changes
-g -g usermod modify your original group belongs to the group change belongs group
-s modified parser usermod -s / bin / zsh test (test parser from the default parser bash {} to zsh)
disables the user: usermod -L username
restore user: usermod -U username

linux Rights Management:
linux file types:
- binary file
d directory
l link file
ls -l path: Specifies the file type
drwxr-xr-x 3 root root 4096 14:46 the Boot September 11
drwxrwxr the X-2 root root 4096-September 14:09 cdrom 11
drwxr-XR-the X-18 root root 4100 9 Yue 12 09:09 dev
in the first column: the file type and permissions
second column: the number of subdirectories or the number of links
in the third column: the file owner
fourth column: owned by group
fifth column: file size
sixth column: date and time
seventh columns: file name
where the first column of a total of 10
first one is the file type
of the 2-4 is the current owner of the file permissions
fifth to 7 indicates permission file belongs to the group
of 8-10 represents the file permissions of the others
Note: the first one is - represents a binary file, later appearing in nine - indicates permission defaults
r: read. 4
W: Writable 2
X: executable. 1
rwx r--. 7 -wx. 4. 3. 6 rw-
644-> evil.php
713 rwx - X-WX


Meaning permissions for files and folders

For the meaning of the meanings file folder
r can view the contents of a file directory listing
w can be modified and new files can be deleted in the folder
x executable file can access files

Change the permissions of the command
chmod {who} {+ | - | =} file names
who: u-> owner g-> belongs to the group o-> others a-> everyone
+ Add permission - permission to cancel the assignment of certain rights =
R & lt - R & lt - r-- test.php
the chmod +320 test.php rwxrw-r-- test.php
rwxrwxrwx test.php
the chmod test.php R & lt -333 - R & lt - r-- test.php
Note: change permissions recommended way digital

Change an owner or owning group
chown root / test will be owner of the test folder Change to root
chgrp ADMIN / test will test your group folder change bit ADMIN
chown root: root / tmp The tmp folder owner and group are changed to root
chown -R root: root / tmp the owner and group of all files in tmp folder are changed to root
chown -R 777 ./* the file or files in the current directory folder and the folder permissions at all 777

whoami view the current user
tar file compression and decompression
netstat Network Status
nslookup view
dns information
program ps to see running
top view real-time programs running
service using a
service control service starts close
curl to get the page, you can use output redirection to download the file
wget downloads

service apache2 start apache service open

view-source: http: //www.baidu.com view the source code Baidu

curl http://www.baidu.com view Baidu source code
curl http://www.baidu.com> baidu.html Baidu to download the source code to baidu.html

linux memory management
ps view the system processes
ps -u / -l to view process information belonging to the current user
ps -aux to see all the users in the system processes information
ps -aux | grep apache apache view the system processes
ps -le | grep apache apache process View system


top display process information (pid, take up memory size, occupancy cpu size, etc.) q to exit the
top -c display the full command
top -d 5 Updated
top -p pid pid view a specific information
PID USER PR (process priority) NI (nice value it represented priority) VIRT (virtual memory) the RES (physical memory)
the SHR (shared memory) S (process status)% cPU (cpu occupancy hundred percent)% MEM (memory for percentage) TIME + (using cpu temporal summation) the COMMAND

Free Linux idle display, the physical memory, swap memory, buffer
total (total physical memory) used (memory used) Free (free memory) shared (multiple processes shared memory) buff / cache (cache size) available


Close kill a process
kill pid (process of the above mentioned id)
-9 forced shutdown
-l restart the process
killall + process name the name of all processes to close

To view ports information
netstat -ano (windows system)
netstat -ntulp (Linux systems)


Linux network management
the ping, netstat route ifconfig arp
traceroute to view the packets in the network path
ss displays socket communication information
ss -t -a show tcp connection
ss -l displays all network connections open ports
socket ss -pl process used

Guess you like

Origin www.cnblogs.com/liujizhou/p/11525127.html