Linux Operations Basics and commands

Source: Internet
Author: User

1,linux system administrator account?
Root
2,[[email protected] ~]# explain the meaning of each part
Root Account
SVR5 Host Name
~ Directory/root
What are the TTY consoles for the 3,linux system?
Tty1-6 Character Interface
TTY7 graphical interface
4, how to view the kernel, and explain the meaning of each part
# Uname-r
2.6.18-371.el5
Major Version Number 2
Minor version number 6
Revision number 18
Red Hat revision 371
5, see which version of the system belongs to Redhat
# Cat/etc/redhat-release
Red Hat Enterprise Linux Server release 5.10 (Tikanga)
6, show what position now
# pwd
7, enter the/etc/sysconfig/network-scripts
# cd/etc/sysconfig/network-scripts
8, long format and provides easy-to-read properties to display files beginning with/boot Vmlinuz
[Email protected] ~]# ls-lh/boot/vmlinuz*
-rw-r--r--1 root root 2.1M 2013-09-06/boot/vmlinuz-2.6.18-371.el5
[Email protected] ~]# find/boot-name vmlinuz*-exec ls-lh {} \;
-rw-r--r--1 root root 2.1M 2013-09-06/boot/vmlinuz-2.6.18-371.el5
9, List/etc Directory properties
[Email protected] ~]# ls-ld/etc
Drwxr-xr-x root root 4096 05-22 19:44/etc
10, recursive display of files and contents in the/boot directory
[Email protected] ~]# ls-r/boot/
11, show root all files including hidden files
[Email protected] ~]# ls-a/root/
12. See how much space each/boot and/etc/pki occupy
[Email protected] ~]# du-sh/boot//etc/pki/
6.5m/boot/
792k/etc/pki/
13, create/vod/movie/cartoon, recursively display/VOD directory structure
[Email protected] ~]# mkdir-p/vod/movie/cartoon
[Email protected] ~]# ls-r/vod/
14, Link System-config-network-tui to/sbin/netconfig
[email protected] ~]# which System-config-network-tui
/usr/sbin/system-config-network-tui
[Email protected] ~]# ln-s/usr/sbin/system-config-network-tui/sbin/netconfig
[Email protected] ~]# ls-l/sbin/netconfig
lrwxrwxrwx 1 root root 05-22 20:19/sbin/netconfig-/usr/sbin/system-config-network-tui
15, copy the/boot/grub/etc/host.conf to the/root/desktop.
[Email protected] ~]# cp-r/boot/grub//etc/host.conf/root/desktop/
16. Remove grub and host.conf under desktop
[Email protected] ~]# ls/root/desktop/
Grub host.conf
[Email protected] ~]# rm-rf/root/desktop/grub//root/desktop/host.conf
[Email protected] ~]# ls/root/desktop/
17. Create a/root/ls-man.txt file to move this file to the desktop
[Email protected] ~]# Touch/root/ls-man.txt
[Email protected] ~]# mv/root/ls-man.txt/root/desktop/
18, renamed Ls-man.txt to Manls.txt
[Email protected] ~]# Mv/root/desktop/ls-man.txt/root/desktop/manls.txt
[Email protected] ~]# Ls/root/desktop/manls.txt
19. Find the absolute path to the shutdown command
[email protected] ~]# which shutdown
/sbin/shutdown
20, create the myhttpd.conf file, use locate to find, is it possible to find this file?
[email protected] ~]# Touch myhttpd.conf
[Email protected] ~]# Locate myhttpd.conf
21, update the database/var/lib/mlocate/mlocate.db, use locate find, is it possible to find this file?
[Email protected] ~]# UpdateDB
[Email protected] ~]# Locate myhttpd.conf
/root/myhttpd.conf
22, delete the myhttpd.conf file, use locate find, is it possible to find this file?
[Email protected] ~]# RM-RF myhttpd.conf
[Email protected] ~]# Locate myhttpd.conf
/root/myhttpd.conf
23. Find the link file under/boot
[Email protected] ~]# Find/boot-type L
/boot/grub/menu.lst
24. Find the directory under/boot
[Email protected] ~]# Find/boot-type D
25. Find the file ending with. conf in/etc under the name Resol.
[Email protected] ~]# Find/etc-name resol*.conf
/etc/resolv.conf
26. display files with the. img End in the/boot format in an easy-to-read property
[Email protected] ~]# ls-lh/boot/*.img
-RW-------1 root root 2.8M 05-21 22:07/boot/initrd-2.6.18-371.el5.img
[Email protected] ~]# find/boot-name *.img-exec ls-lh {} \;
-RW-------1 root root 2.8M 05-21 22:07/boot/initrd-2.6.18-371.el5.img
27. Look for files with the. img End and greater than 2M under/boot
[Email protected] ~]# find/boot-name *.img-a-size +2m
/boot/initrd-2.6.18-371.el5.img
28. Find file names that have changed over/above or equal to 5 days before/var
[Email protected] ~]# find/var/-mtime +4
29, view/etc/passwd Top 5 lines
[Email protected] ~]# head-n 5/etc/passwd
30, view/etc/passwd tail 5 lines
[Email protected] ~]# tail-n 5/etc/passwd
31, view/etc/passwd's 8–12 line
[Email protected] ~]# Head-n 12/etc/passwd | Tail-n 5
32, how many accounts are in the statistical system?
[Email protected] ~]# wc-l/etc/passwd
32/etc/passwd
33, calculate the number of conf configuration files in the/etc directory.
[Email protected] ~]# Find/etc-name *.conf | Wc-l
244
34, display the contents of 127.0.0.1 in/etc/hosts
[[email protected] ~]# grep 127.0.0.1/etc/hosts
127.0.0.1 localhost.localdomain localhost
35, displays the contents of/etc/passwd as Root
[[email protected] ~]# grep ^root/etc/passwd
Root:x:0:0:root:/root:/bin/bash
36, show content in/etc/passwd that ends with bash
[Email protected] ~]# grep bash$/etc/passwd
Root:x:0:0:root:/root:/bin/bash
37. Remove blank lines from/etc/hosts.allow and show the results
[Email protected] ~]# grep-v "^$"/etc/hosts.allow
38, showing the contents of/etc/hosts not starting with the # number
[Email protected] ~]# grep-v "^#"/etc/hosts
127.0.0.1 localhost.localdomain localhost
:: 1 localhost6.localdomain6 Localhost6
39, calculate the number of users to login shell with/bin/bash
[Email protected] ~]# grep/bin/bash$/etc/passwd | Wc-l
1
40, find content in/etc/hosts that contains 127.0.0.1 or localhost
[Email protected] ~]# grep-e "127.0.0.1|localhost"/etc/hosts
127.0.0.1 localhost.localdomain localhost
:: 1 localhost6.localdomain6 Localhost6
41. Display/root content in a readable property and long format to redirect the results to/root/gztest.txt inside
[Email protected] ~]# ls-lh/root/>/root/gztest.txt
42, compression and decompression of/root/gztest.txt using gzip and bzip2 respectively
[Email protected] ~]# gzip gztest.txt
[Email protected] ~]# gzip-d gztest.txt
[Email protected] ~]# bzip2 gztest.txt
[Email protected] ~]# bzip2-d gztest.txt.bz2
43. Pack and compress the/etc/mail into the/root/mail.tar.gz
[Email protected] ~]# Tar-zcf/root/mail.tar.gz/etc/mail
44. Pack and compress the/etc/mail into the/root/mail.tar.bz2
[Email protected] ~]# Tar-jcf/root/mail.tar.bz2/etc/mail
45. Unzip the mail.tar.gz to/TMP and delete the/TMP/ETC directory
[Email protected] ~]# tar-zxf/root/mail.tar.gz-c/tmp/
[Email protected] ~]# rm-rf/tmp/etc/
46. Unzip the MAIL.TAR.BZ2 to/TMP and delete the/TMP/ETC directory
[Email protected] ~]# tar-jxf/root/mail.tar.bz2-c/tmp/
[Email protected] ~]# rm-rf/tmp/etc/
47, please create a directory named Vimtest in the/tmp directory.
[Email protected] ~]# mkdir/tmp/vimtest
48, enter the Vimtest directory
[Email protected] ~]# cd/tmp/vimtest/
49. Copy the/etc/man.config to the bottom of this directory
[Email protected] vimtest]# cp/etc/man.config.
50, use Vim to open the Man.config in this directory
[Email protected] vimtest]# vim Man.config
51, set the line number in Vim
: Set Nu
52, move to line 58th, move to the right 40 characters, what do you see in the double quotation marks in the directory?
: 58
40->
/dir/bin/foo
53, move to the first line, and search down the string ' bzip2 ', may I ask what line he is in?
1G
/BZIP2 118/137
54, I want to change the ' lowercase man string ' between 50 and 100 rows to ' uppercase man string ', and if a selection needs to be modified, how can I place an instruction? If you keep pressing ' Y ' during the selection process, the result will change a few guys in the last line.
: 50,100S/MAN/MAN/GC
55, after the modification, suddenly back, to recover all, what are the methods?
Uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu .....
: q!
56, I want to copy the contents of the nine lines (containing Manpath_map) from 65 to 73, and post to the last line
: 65
9yy
G
P
57,21 to 42 lines from the beginning of the # symbol I don't want it, how do I delete it?
: 21
: 21,42s/^#//g
58. Save this file as a Man.test.config file name
: w Man.test.config
59, add a row in the first line, the line content input ' I am a student ... '
1G
O
I am a student ...
60, save and leave.
: Wq/:x/zz


This article from the "CPD" blog, reproduced please contact the author!

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.