Linux Learning Notes

Source: Internet
Author: User

Systemctl--user Enable PulseAudio
Description: The system does not have sound after installation and can be opened with this command.

Ifconfig eth0 192.168.118.1
Note: Set the IP address for the network card.

Apt-get Install Uget
Apt-get Install ARIA2
Description: Uget is a popular download tool in Kali, ARIA2 is a plugin.

The following is a diary of the brothers even Linux tutorial study
2016-9-12 Study Diary
LS View the files under the directory, the following are the common options
Ls-l long, length display, detail
Ls-a Show all files, including hidden files
LS-LH is displayed in a way that is easy for humans to understand, mainly refers to the size of the file.
-Indicates that the file d indicates that the directory L represents the link.
U owner G-owned group O others
-rw-------, correspond to the above sequence.
LS-LD displays the directory itself and does not display the following files, which are generally used in conjunction with L.
Xxls-i Displays the node, which is used later.

mkdir Creating a Directory
Mkdir-p Creating a directory recursively
CD Switch Directory
PWD Print working directory, showing the current absolute directory
. Represents the current directory,.. Indicates a parent directory
RmDir Delete Empty Directory

CP Copy File
Cp-r Copy Directory
Cp-p Preserve file attributes

Mv:move Shearing, renaming
Ctrl C or clear to clean up the terminal.

RM Delete File
RM-RF file or directory
Rm-r Deleting a directory
Rm-f Enforcement

2016-9-18 Study Diary
4.1.3

Touch Create File
Creating a file name with spaces requires the entire file name to be wrapped in double quotation marks (no spaces are recommended).
Cat
Browse the contents of a file (for files with fewer search content)
-N Display Line number
More (very important)
Pagination Display file
The space is a page-by-page display, enter a line of the display, Q exits
Less
As with more, the difference is that you can page up
/followed by the keywords to find can search, n can search down.

Head-n
You can view the first few lines of a file.
Tail-n
The last few lines of the file can be viewed
Tail-f
Dynamically displays the content at the end of a file and updates it dynamically.
Exit Ctrl-c

4.1.4
LN generates a linked file-s
Ln-s Original File Destination file
Plus S is a soft link, not plus s is a hard link
Link files are equivalent to Windows shortcuts
Soft link permissions are not equal to the original file permissions
Soft links When viewing the properties of a file, there is a file that shows the point
The hard link does not have this symbol, and the property is the same as the original file.
Hard-link files can still save the contents of a file if the original file has been removed from the soft link prompt without a directory
Hard links are the same as file copies and can be updated synchronously.
Ls-i can view the hard-link I node, the same as the original file (each file has a unique node)
Note: Hard links cannot span partitions, soft links can be, hard links cannot be linked to directories, soft links can

4.2.1
chmod
Change permissions for a file or directory
chmod [{ugoa}{+-=}{rwx}] [file or directory]
U: Owner, G: Belongs to Group, O: Others, a: all people
chmod u+x file name
chmod g+w,o-r file name
chmod g=rwx file name
The following are the most used methods:
Numerical notation
R---4
W---2
X---1
Chmod-r file name
Recursive modification
chmod 777/temp/a/b
Equals
chmod 777/temp/a
Recursively modify directories and the following directories and files
Note: The relationship between file permissions and directory permissions has an inheritance relationship

2016-9-19 Study Diary
Chown
Description: Change the owner of a file or directory
Only the root user and the owner can change the permissions of the file and only the root user can change the file or directory owner.
chown [user] [file or directory]
Chgrp
Description: Change the owning group of a file or directory

Umask
Description: Display, set default permissions for files
Common commands
Umask-s default permissions for new files in rwx form
New files in Linux are not executable permissions
The Umask command will display 022, about 022 as explained below:
0 Special Permissions
022
777 Rwx RWX rwx
022----w-w-
--------------------XOR or
755 WRX R-x R-x
This is how the directory is represented
Change the default method as follows
Umask 077 (The above changes are not recommended)

4.3.1 File Search Command
Find
Description: File Search
Usage: Find [Search Range] [match condition]
Find/etc-name init-name is a parameter option
Find/etc-name *init* * is a wildcard character that indicates that a file hit contains init
Find/etc-name init* means searching for files starting with Init
Find/etc-name Init??? ? A wildcard that represents a single character
The above search is case-sensitive
Find/etc-iname Init-iname indicates case insensitive
Do not use the Find command at peak server time, the smaller the search, the better

Find/-size +204800 means search by file size, where +n represents greater than n,-n means less than n,n means equals n
In Linux, the file size is represented as a block of data, and the conversion method is as follows: 1 data block = 512 bytes =0.5k

Find/home-user User Name
Search by Owner

Find/etc-cmin-5
Find files and directories that have been modified within 5 minutes in the/etc directory
-amin Accessing Time Access
-cmin file attribute Change
-mmin File Contents Modify
Complex search Commands
Find/etc-size +163840-a-size-204800
Description: In/etc look for files larger than 80M less than 100M-a means that both the-O representation of two conditions satisfies a
Find/etc-name init-exec ls-l {} \;
Find the init file in/etc and display its details, {} \;
Find/etc-name init*-a-type f-exec ls-l {} \;
Find/etc-name init*-a-type f-ok ls-l {} \;
The difference between the above two is one-by-one display and ask
such as: Find/etc-name temp-ok rm {} \;
Ask if you want to delete
Note that each of the above statements ends with a semicolon;
-inum based on I-node lookup
Find. -inum 3223-exec rm {} \;
4.3.2 Other File Search commands
2016-9-21 Study Diary
4.3.2 Other File Search commands
1, locate
Description: Find files in the file repository
Locate file name
A file repository is built on-premises and is updated periodically
The newly built file can not be searched with locate, need to update the database manually, use the command updatedb
However, if you create a new file in a different folder (such as TMP), you may not be able to search
Locate-i file name, indicating that the case is ignored when looking for
Locate is not often used

2, which
Description: Search the directory and alias information of the command
Usage: which command
Which LS, you can find the path of the command and the alias of the command

3, Whereis
Description: Search the directory where the command is located and the Help document path
Whereis ls
4. grep
Usage: Grep-iv Specify string file
Description: Searches the file for string matching lines and outputs
-I is case insensitive
-V excludes the specified string
Example: grep mysql/root/install.log
The result of the search is to match the requirements of the column
Grep-v ^#/etc/inittab
Exclude lines with the # number switch
4.4 Help Commands
1, man
Description: Get help information
Usage: Man command or configuration file
Example: Man ls
Man Services (config file) Note Do not add paths
In addition, the man 1 or 5 ls,1 represents the command's help information, and 5 represents the Help information for the configuration file
2. Whatis command
Description: View the information in the command name section, mainly about the main information of the command.
3, apropos the name of the preparation file
Description: View the primary information for the configuration file.
4. Command--help
Description: Options for the main list of commands
Usage: LS--help;
5. Help
Description: Use Help to see some of the shell's built-in commands
You cannot view built-in commands using man.

2016-9-22 Study Diary
4.5 User Management commands

1, Useradd
Description: Add a new user
Usage: Useradd User name
2, passwd
Description: Set User password
passwd User Name
3. Who
Description: View the logged in user information to display the currently logged on user.
Usage who
TTY indicates a local login, and PTS indicates a terminal login
4, W
Description: View details of the logged in user, more than who
4.6 Compression Decompression Command
. gz format
gzip Compressed Files Note: Only files can be compressed, not used in directories, and original files are not preserved
Gzip file name
Gunzip Unzip a file

Tar
Description: Packaging
Usage: TAR-CVF file name
The general use of the network is to first use tar packaging, and then gzip compression, generate the file name. tar.gz, many of the original code is packaged and uploaded.
Packaging and compression can be done in one step, that is, with the-Z option, TAR-ZCF.
-X
Description: Unpack the Package
Usage:
Tar-xvfz

. zip format
Zip
Description: Compress a file or directory
Usage: Zip [-r] [compressed file name] [file or directory]
Note: You can keep the original file
The-r option is to compress the directory
Unzip
Description: Unzip
Usage: Unzip file name

Bzip2
Description: Compressed file, is the ZIP upgrade version, the proportion of compression is larger,
Mainly used in the file relatively large time, produce bz2 format of the compressed file.
Usage: bzip2 options [-k][file]
-K retain original file after generating compressed file
Example: Bzip2-k file name
TAR-CJF file name. tar.bz2
Bunzip2
Description: Unzip
Usage: BUNZIP2 option [-K] Compress file
-K retain original file after decompression
Example: TAR-XJF file name. tar.bz2

4.7 Network Commands
Write
Description: Send message to specific user with Ctrl +d save end
Usage: Write user name
Wall
Description: Send information to all online users
Usage: Content sent by wall
Ping
Description: Test the connectivity of the network
Usage: Ping option IP address
-c Number of times sent
Note: Ping is always on without options
Ifconfig
Description: View or set network card information
Usage: ifconfig NIC name IP address
Example: IFCONIFG eth0 IP Address
Mail
Description: View Send e-mail
Usage: Mail user name (root)
Note End sending with Ctrl +D
Last
Description: Lists user information currently logged into the system with the past.
Lastlog
Description: Check the last logon time for a specific user
Usage: Lastlog
Lastlog-u 502
Traceroute
Description: Shows the path to the host time of the packet.
Example: Traceroute www.baidu.com
Netstat
Description: Display network-related information
Usage: netstat[options]
-T:TCP protocol
-U:UDP protocol
-L: Monitor
-R: Routing
-N: Show IP address and port
Cases:
Netstat-tlun viewing the port on which this machine listens
Netstat-an View all network connections on this computer
Netstat-rn viewing the native routing table


Setup
Description: Configure the network
Example: Setup
Note: Setup can only be used in Redhat
Mount
Note: Connect the device to the mount point
Usage: Mount [-t file] device file name mount point
Example: mount-t iso9660/dev/sr0/mnt/cdrom Note: sr0 device file name is automatically given by the system
Unmount
Description: Uninstalling a mounted device file
Usage: Unmount device file name
4.8 Shutdown restart
Shutdown
Description: Shut down the machine
Usage: shutdown [options] [TIME]
-C cancels the previous shutdown command
-H shutdown
-R Restart

2016-9-26 Study Diary
6.1-6.2.4 RPM Management
RPM Installation
Usage:
RPM-IVH Package Full Name
Selection Explanation:
-I Installation
-V Show More information
-H Show Progress
--Nodeps does not detect dependencies
-U Upgrade
-e Uninstall
-Q Query
-A queries all installed PRM packages
-I query installed and RPM package information, used with-Q
-P query does not install RPM package information, use with-Q
-L Query the path information for the installation package, using with-Q
-F Query which package the system file belongs to and use with-Q
-R queries the dependencies of the package, either with-Q or with-p, querying the dependencies of the installation packages that are not installed.
The-V verifies the files in the specified RPM package, primarily judging if the file has been modified, rpm-v the package name, and the query results will display a subset of the characters, identifying which parts have been modified.

Rpm2cpio
Description: RPM Package Extracts a file
Usage: Rmp2cpio package full name |cpio-idv. File absolute Path
Cpio
Description: is a standard tool for creating software archive files and extracting files from archive files
Note: The point represents the current directory.


Bird Brother Linux Learning Diary (2016-9-22)
1, graphics and text mode switching method
Ctrl+alt+f1~f6 enter the terminal of the text interface
Ctrl+alt+f7 into the graphical interface desktop
In addition, you can enter the STARTX command in the text terminal to enter the graphics interface
2./usr/share/doc Catalogue
Description: Information and principles and design process of some commands or software.
3, shutdown operation
Sync writes data to instructions in the hard disk
Shutdown the most correct shutdown instructions
Reboot restart
Halt shut down the machine
4,/etc/passwd/etc/shadow
Note: These two directories are information about the password of the system user name, and the account management can be modified from both directories.
/etc/group/etc/gshadow
Description: These two directories are information about the system user group, and some management of the user group can be manipulated directly from these two directories.
5, Groupadd
Note: Instructions are used to increase the group, and only/etc/group and/etc/gshadow are applied to the files.
Groupdel
Description: Delete the user group, but before this, delete the user with the same group ID as the groups group ID.
Useradd
Description: Used to create an account that affects the file with the following:
/etc/passwd
/etc/shadow
/etc/group
/etc/gshadow
/etc/skel
/etc/default/useradd This file is about some of the default settings for pre-built accounts
/etc/login.defs This file is about some of the default settings for pre-built accounts
Userdel
Description: Delete Directory
6. Identity transformation
The first: Su, need to know the root password, but if the administrator more prone to cause password disclosure.
The second: sudo, you only need to enter the current user's password, do not need the root password. However, you need to be aware of whether the user has permission to execute sudo, which user privileges can be set in/etc/dudoers
7. User Enquiry
Id
Description: Displays information such as UID GID for the current login
Groups
Description: Displays the group to which the current login belongs
Finger
Description: Displays detailed information about the relevant user
8. Shell
Alias
Description: Combine a simple alias with a complex and frequently used command
Example: Alias lm= ' Ls-al '
Echo
Description: Displays the contents of a variable
Usage: Echo $ variable name, variable name mainly includes global variables such as Path HOME mail
Env
Description: Displays the main variable contents of the system
Usage: env
Set
Description: Displays the contents of all variables in the system, and can also be used to set their own variables














Linux Learning Notes

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.