Linux Learning Notes Lesson Three

Source: Internet
Author: User
Tags clear screen log log dmesg

I. Directory structure

Second, simple command (ls,cd,pwd,which,alias,pstree,tree)

Third, the environment variable path application

Four, shortcut keys

V. Extended knowledge (Stty, ping and/var/log)


I. Directory structure

1,/bin,/sbin,/usr/bin,/usr/sbin command directory: Lli under the directory are executable files, color green. Root->sbin bin-> Normal user

2./boot kernel and Boot program directory/etc/grub.conf->/boot/grub/grup.conf commonly used

3./dev store Linux external devices

MOUNT/DEV/CDROM/MNT; load the optical drive

/dev/null Empty Directory

4,/etc/configuration file directory these days commonly used in the configuration file

/etc/grub.conf

/etc/ Inittab

/etc/ Sysconfig/network-scripts/ifcfg-eth0

/etc/ hosts

/etc/ resolv.conf

/etc/ selinux/conf

5./Home General user main directory/root root user home directory

6./lib command executes the required dynamic load library file

Ldd/bin/ls Sometimes the command cannot be executed, that is, the library file is missing

7,/media,/mnt temporary mount directory//MOUNT/DEV/CDROM/MNT

8,/opt storage of certain large-scale software or special software directory, such as Oracle

9,/proc system kernel-related/proc/1,/proc/meminfo,/proc/cpuinfo commonly used

10./tmp Temp file directory

11, the/USR program directory, the equivalent of programs file. /usr/local/apache2

12, the/var system often need to change files. /var/log,/var/spool/cron

13,/selinux/etc/selinux/conf

14,/srv store Some services need to extract data after the start

15,/sys Cat/etc/fstab

The/sys/class contains all the device types registered in kernel, linked to devices

/sys/dev maintains a list of primary and secondary numbers by character device and block device, linked to device

/sys/device is a global device architecture, containing all the discovered physical devices registered on various buses, a hierarchical representation model of all the devices in the system, and the most important directory structure for/sys file system management devices.

/SYS/FS describes all file systems in the system

/sys/kernel stores all the adjustable parameters in the kernel


II. basic Commands

1, ls display file or directory information

-a displays all files or directories, including hidden files

-L Show more information

-D displays the information itself. Ls-ld often used

-T sorts by time, from new to old. -rt from old to new

-I display file inode number

The Find parameter again forgot **************************

[Email protected] tmp]# ls-i
11420 1.txt 11540 2.txt yum.log
[[email protected] tmp]# Find-inum 11420-exec rm {} \;
[[email protected] tmp]# Find-inum 11540 | Xargs RM-RF

[Email protected] tmp]# Find/var/log-type f-exec ls-s {} \; | Sort-n | Head-5 find the 5 largest files


*****************************************************************

2. cd

CD ~ Switch to home directory

· CD-Switch to the previous directory

Cd.. .. /.. Parent directory and Upper parent directory

3. PWD Displays the current directory

-P Hard-Link directory

-L soft-Connect directory default

4, which LS gets the absolute path of the command, if it is an alias, displays the alias information

5. Alias view command alias /ROOT/.BASHRC permanently save aliases.

[[email protected] ~]# alias

[[email protected] ~]# alias abc= "Ls-l"

[[email protected] ~]# ABC//And Ls-l command

[[email protected] ~]# unalias ABC// Cancel Alias

6, Pstree show the number of processes. Init is the first process

7, TREE-CL 2 /-C color Display/Two-level directory tree


Third, PATH (application)

[[email protected] ~]# echo $PATH//System environment variable value of PATH

[Email protected] ~]# CP/BIN/LS/TMP/ABC

[[email protected] ~]#/TMP/ABC///TMP/ABC same as/bin/ls effect

[Email protected] ~]# path= $PATH:/tmp//Then ABC is the same as LS command.

[Email protected] ~]# echo $PATH

[Email protected] ~]# source/etc/profile//or. /etc/profile immediate effect

[Email protected] ~]#. /etc/profile//. There are spaces after

************************************************************************************************

[Email protected] ~]# path= $PATH:/usr/local/apache2/bin//face often appears in questions

[[email protected] ~]# echo "path= $PATH:/usr/local/apache2/bin" >>/etc/profile//Restart in effect

************************************************************************************************


Four, shortcut keys (Bold not mastered shortcut keys)

CTRL + C Cancel command

CTRL + Z Pause command

CTRL + a cursor to the beginning

Ctrl+e cursor to end of line

Ctrl+u all characters before the cursor is clipped

Ctrl+k all characters after clipping cursor

ctrl+p Sticky Paste

Ctrl+l Clear Screen

Ctrl+d Sign Out = = Exit

ctrl+s Lock Command terminal, press any key will not react

ctrl+q unlock Command terminal


V. Expansion of knowledge

1. Press CTRL + C, the command will appear behind the ^c, how to remove it?

[email protected] ~]# Yum install-y tree^c
[Email protected] ~]# Stty-ctlecho
[email protected] ~]# Yum install-y tree
[Email protected] ~]# Stty Ctlecho
[email protected] ~]# Yum install-y tree^c

[[email protected] ~]# echo "Stty-ctlecho" >>/ROOT/.BASHRC//Permanent effect

2. Change kernel parameters to make it impossible for others to ping themselves (both kernel and firewall are possible)

[Email protected] ~]# Cat/proc/sys/net/ipv4/icmp_echo_ignore_all
0

[Email protected] ~]# echo 1 >/proc/sys/net/ipv4/icmp_echo_ignore_all

[[email protected] ~]# iptables-a input-p icmp-j DROP//Deny Ping

3,/var/log log //face test See, understand first


(1)/var/log/messages-includes overall system information, which also contains logs during system startup. In addition, content such as Mail,cron,daemon,kern and Auth is also recorded in the Var/log/messages log.
(2)/var/log/dmesg-contains kernel buffering information (kernel ring buffer). When the system starts, many hardware-related information is displayed on the screen. You can view them with DMESG.
(3)/var/log/auth.log-contains system licensing information, including user login and use of the Authority mechanism.
(4)/var/log/boot.log-contains the log at system startup.
(5)/var/log/daemon.log-contains various system daemon log information.
(6)/var/log/dpkg.log– includes installation or DPKG command to clear the log of the package.
(7)/var/log/kern.log– contains logs generated by the kernel to help resolve problems when customizing the kernel.
(8)/var/log/lastlog-records the most recent information for all users. This is not an ASCII file, so you need to use the Lastlog command to view the content.
(9)/var/log/maillog/var/log/mail.log-contains the log information of the system running e-mail server. For example, SendMail log information is all sent to this file.
(/var/log/user.log-) Logs of all levels of user information are recorded.
(one)/var/log/xorg.x.log-the log information from X.
/var/log/alternatives.log– Update replacement information is recorded in this file.
/var/log/btmp– Logs all failed login information. Use the last command to view the Btmp file. For example, "Last-f/var/log/btmp | More ".
(/var/log/cups-) A log that involves all printed information.
(/var/log/anaconda.log-) When installing Linux, all installation information is stored in this file.
(/var/log/yum.log-) contains information about packages that are installed with Yum.
/var/log/cron-each time the cron process starts a job, the relevant information is recorded in this file.
/var/log/secure-contains verification and authorization information. For example, SSHD will record all information (including failed logins) here.
(+)/var/log/wtmp or/var/log/utmp-contains login information. Use Wtmp to find out who is logging into the system, who uses the command to display this file or information, and so on.
(/var/log/faillog–) contains user logon failure information. In addition, the error login command is also recorded in this file.
(21) In addition to the above log file,/var/log also contains the following subdirectories based on system-specific applications:
/var/log/httpd/or/var/log/apache2-contains server Access_log and error_log information.
/var/log/lighttpd/-contains light httpd access_log and Error_log.
/var/log/mail/– This subdirectory contains additional logs for the mail server.
/var/log/prelink/-contains the information that the. So file was PreLink modified.
(/var/log/audit/-) contains information stored by the Linux audit daemon.
/var/log/samba/– contains information stored by Samba.
/var/log/sa/-contains the SAR files collected daily by the Sysstat package.
/var/log/sssd/– is used for daemon security services.


The above basic commands have been cooked rotten in the heart, make notes, most of the time is feeling in the share, but also in the continuous improvement of their ability to summarize. Hope that everyone and I, as soon as possible to leave the Heldesk group, to the server operation and maintenance!

This article is from the Linux Learning Notes blog, so be sure to keep this source http://genxin.blog.51cto.com/665191/1620311

Linux Learning Notes Lesson Three

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.