Linux Basic Learning Notes

Source: Internet
Author: User
Tags bz2

Linux Command Learning
Linux considerations:
1 Linux is case-insensitive, Windows is case-insensitive, all commands are lowercase under Linux, file names are case-sensitive under Linux, and file names under Windows are case-insensitive.

2 Everything in Linux is saved as a file, including hard drives. If it is not written to the file and is written to memory, then the restart is invalidated. The hardware is manipulated for file name operations.

3 Linux does not differentiate file types by extension. Files are distinguished by file permissions. However, when the operation is often accompanied by some specific "extensions" to help administrators better identify files, Linux does not require the addition of extension.

4 Linux All storage devices must be hung before users can use them, including hard drives, USB drives, and discs.

5 programs under Windows cannot be installed and run directly on Linux.


The role of Linux directories
1/bin/: The directory where the system commands are stored, which can be performed by both ordinary and super users. Commands placed under/bin can also be executed in single-user mode.

2/sbin/: Save the commands associated with the system environment setting, only the superuser can use these commands for system environment settings, but some commands can be viewed by ordinary users.

3/user/bin: Store system commands, both normal and Superuser can execute.

4/user/sbin/: An unnecessary system administration command to store the root file system. Only super users can use it.

5/boot/: System startup directory.

6/dev/: Device Catalog.

Add:/etc/: The location where the configuration file is saved.

7/home/: Home directory for ordinary users. /home/user1

8/lost+found/: When the system crashes unexpectedly or the machine shuts down unexpectedly, some file fragments are stored here. Each partition has its own Lost+found directory.

9/media/: Hangs in the directory, system recommendations are used to hang on the media device. For example, floppy disk or CD.

10/mnt/: Mount directory. Mount the operating system partitions such as removable hard disks, USB drives, etc.

11/mise/: Mount directory. The system recommends a shared directory to mount the NFS service.

12/opt/: Third-party installed software save location. But generally placed under the/user/local.

13/proc/: Virtual file system. The data in this directory is not stored on the hard disk. General storage device Driver List network protocol, etc., in memory.

14/sys/: Virtual file system.

15/root/: Super User directory.

16/srv/: Service Data Catalog.

17/tmp/: Temp directory.

18/usr/: System software Resource directory. No user data is stored.

19/var/: Dynamic Data save location.


Server Considerations

1 remote server does not allow shutdown, only reboot

2 The service should be turned off when restarting

3 do not run high load commands on server access spikes (antivirus, unzip, transfer files These are high load commands)

4 Remote settings Firewall do not put themselves to the server (firewall is a filtering process, as long as the access through the IP address filtering, and anti-virus software is a different thing)

5 Specify a reasonable password specification and do it regularly.

6 Reasonable allocation of rights, regular backup of important data and logs


File processing commands
1 command format with directory processing command ls
Command format: command [-options] [parameters] all users can use
2 Directory processing commands
LS (list) command is located on the path/bin/ls
The role of Ls-a-A is to display all files, including displaying hidden files, to '. ' The file that begins is the hidden file.
Ls-l
Ls-lh
Ls-i

mkdir (make director) Mkdir/tmp/xiaodianying (right)
Mkdir/tmp/dianying/xiaodianying (Error)
Mkdir-p mkdir/tmp/dianying/xiaodianying (right)
mkdir mkdir/tep/dianying/tmp/xiaodianying (right)
CD (Chang directory) cd/tmp/dianying
PWD (print working directory)
Cd.
Cd..
RmDir rmdir/tmp/dianying
CP (copy)
Cp-r
Cp-p
MV (move)
RM (remove)
Rm-r
Rm-f
Touch
Cat
Cat-n
Tac
More
Less
Less/keyword
Head-n Line number/file
Tail-n Line number/file
Ln-s soft connections are equivalent to Windows shortcuts that can be used across partitions for directory use Rights all RWX
ln a hard link similar to a copy can also synchronize update source files missing this hard link or can be executed cannot cross partition cannot be used for directory


3 File processing commands

-rw-r--r--
File U g o
R W X
D-l

4 Link commands

Linux Common commands

Rights Management Commands

chmod u-r u+r U=R/TMP/WDX
777/tmp/wdx
To file R (cat more less tail head) W (VIM) x (Command script)
To directory R (LS) W (Touch mkdir rmdir RM) x (CD)
Rights Management root and owner can be manipulated
Remember: To delete a file, the directory where the file resides must have W permissions
To view a file, the directory where the file resides must have R permission
To execute the file, the directory where the file resides must have X permissions
A permission is an inherited relationship.

Chown
Only Root can operate
Chown Testing (User): Group file or directory


CHGRP Group name File
Groupadd
Umask-s all new files under Linux will have the X permission canceled so umask see the value of touch after the x is removed
Umask directly executes, the number is the permission mask, which should be 777-022

With Umask The default permissions, you need to use mask settings umask 023 To change the default permissions to rwx-r-xr--


Find

Find * matches any number of any character? Match a character
Find Directory-name (case-sensitive) file name
Find Directory-iname (case-insensitive) file name
Find directory-size + or-or = Number (indicates a file that is larger than the number in the root directory, number is a multiple of 0.5KB data block the minimum storage unit under Linux is 512k)
Find directory-user user name
Find Directory-group Group name
Find Directory-cmin-time (Files modified after properties in a certain time)
Find Directory-amin-time (files that have been accessed enough in a certain time)
Find Directory-mmin-time (a file that has been modified in a certain time period)
Find directory-size + digital 1-a-Number 2 (file between number 1 and number 2)
Find directory-size + digital 1-o-Array 2 (file between number 1 or number 2)
Find directory-type D (directory) f (file) L (soft Connect) (usually used with other lookup connections)
Find directory-name filename-exec ls-l {} \;(where {} \; is fixed format)
Find directory-name file name-ok {} \;(where {} \; is fixed format)
(-exec and-ok are the connectors that perform the action)

Find directory-inum node number-exec rm {} \;
(often used to find hard links and delete operations)

Locate file name
When using locate, UpdateDB first, but UpdateDB command does not work for temp file/tmp

Locate-i file name is case-insensitive search

which command
Whereis command (lists the file absolute path and the location of the help document)

grep content file Directory
Grep-i content file directory (case-insensitive search)
Grep-n content file directory (output line number)
grep--color=auto Content file directory
Grep-v content file directory (reverse lookup)
Grep-v ^# file directory (excludes lines with the first letter #)


Help commands

Man (manual) man ls (view command Help) man services (see configuration file Help, no need to add absolute path to configuration file)

Use the/keyword to find the location of the keyword under the man command


Use man to view commands and configuration file Help

Help documentation has two 1 rep commands for help 5 for configuration file Help

For configuration files and commands the same name can be separated by the man 1 passwd and the man 5 passwd zone

Whatis ls whatis plus command to view command information directly

Apropos services apropos a short message that allows you to view the configuration file directly

LS--help can directly list the options for command LS

Shell is a command interpreter, there are some built-in commands, such commands can not be viewed with man, such commands have cd,umask, such as the Command Man CD will not open the CD Help, will open the shell's help information, if you want to get help information shell command, You can use the Help CD to get information about the CD.


User Management commands

Useradd can use Useradd only under root WDX
passwd set the user's password passwd WDX
Under your own account, the password can be passwd directly.
Who Linux can log in to multiple users at the same time the WHO command can see how many users are online where the TTY indicates a local login (i.e. a virtual machine login), and PTS indicates a remote login
W command to get more detailed information about the user login it's very informative.


Linux compression commands

Compressed format. zip is a format that Linux and Windows do not need to install software to decompress
. GZ is a compressed file format command under Linux, gzip Add file name can be compressed gunzip plus file name (unzip) or use gzip-d file name
Gzip only compresses files and does not retain original files
Tar-c (Package) v (Details optional option) F (file name) compressed name/directory TAR-CVF WDX.TAR/TMP/TESTING/WDX
After the. tar file is generated, continue to use gzip compression to finally form wdx.tar.gz

TAR-ZCVF WDX.TAR.GZ/TMP/TESTING/WDX This command is a synthesis of the above two commands. This is the most commonly used compression command

TAR-ZXVF wdx.tar.gz Unpacking

-Z Unzip to GZ
-X unpacking to Tar
-C pressure Pack to tar
-v details (optional)
-f Specifies the compressed file

Zip command to compress the remaining original files
Zip-r WDX.ZIP/TMP/TESTING/WDX Compression directory when you need to add-r Such an option if you want to shrink the file does not need to add-r
Unzip decompression

Because zip compression ability is not as good as GZ, so use less

bzip2 command compresses the original file, and the compression ratio is very strong
BZIP2 file name
Bzip2-k file name (-K can retain the original file)
TAR-CJF WDX.TAR.BZ2/TMP/TESTING/WDX
BZIP2 wdx.bz2 Decompression
TAR-XJF wdx.tar.bz2 Decompression
It's obvious-j for bz2.


Network commands

Write user name Content Ctrl+d End input sent, if the error is lost with CTRL + the return key deleted or delete
Wall (write all) content (send information to all users)
Ping the IP address (always ping Ctrl + C stop)
PING-C Number of IP addresses

Ifconfig direct return to view IP condition eth0 nic Lo loopback address

Mail User name Email
Mail View message
H key to view mailing list
D Plus list label Delete mail

Last statistics all user login information
Lastlog View user's last login information
Last-u User Number

Traceroute host address a very important command

NETSTAT-T (check TCP protocol)-U (check UDP protocol)-L (Listen)-R (Route)-N (show IP address and port number)-an (show all IP addresses and port numbers) about port number: The originating port is random, the received port is fixed

NETSTAT-RN View Gateway

The role of DHCP is to automatically assign IP services within the LAN, so if you want to use this service you need to determine whether there is a DHCP server in the LAN to provide services.

The Setup command is a Redhat series Linux-specific command, which functions as a GUI-configured network, which is permanently in effect and requires a system restart after configuration, service network restart


Mount command
Mount device file name mount point example: Mount-t iso9660/dev/sr0/mnt/cdrom
The entire process of closing the disk is mounted:
1 All created directories: MKDIR/MNT/WDX
2 Mount [-t iso9660] (if the system knows the device name or automatic identification can be omitted)/dev/sr0 (the optical device name, where sr0 is a soft connection, is automatically specified by the system, so the front-T iso9660 can be omitted)/mnt/cdrom
3 If you need to uninstall the command is Umount/mnt/cdrom


Shutdown and restart
Shutdown-h now (on behalf of the current shutdown)
Shutdown-h 20:30
Shutdown-r now restart
Shutdown-c Cancel the previous shutdown command
It is recommended to use the Shutdown command, which is the most primitive command to save data, although there are other commands or tools that can be used to shut down the machine, but in case of this, we recommend the use of shutdown. It is best to stop the service and protect the hard drive before shutting down or restarting.

Other commands:
Halt command shutdown
Poweroff shut down the machine
Init 0 shutdown
Reboot restart
Init 6 Restart

System operating level:
0 Turn off the machine
1 single user, equivalent to Safe mode, commonly used to repair
2 not fully multiuser, without NFS (file sharing Service) service commands (because Linux is not safe for this)
3 full multi-user, i.e. full command line
4 Not assigned
5 graphical interface
6 restart
Modify RunLevel Command init number
The same system run-level information can be seen in Cat/etc/inittab
To view the current runlevel with runlevel print two digits the first number is the runlevel before the boot, and the second number is the RunLevel at boot time.

Logout command quit user command after you have finished the operation, be sure to exit

Text Editor (VIM)
Vim does not have a menu, only commands, you can create, edit, display text files.
Vim three modes of operation: Command mode, insert mode, edit mode.
VI filename (enter), after entering the default is the command mode
: Wq (Exit)

: R file Name
:!which ls:r!date
Custom shortcut: Map ctrl+v+p i#<esc> means pressing ctrl+p to the beginning of insertion #
Map ctrl+v+b 0x means press Ctrl+b to delete the first line of letters
Map ctrl+v+h [Email protected]<esc>

N1,n2s/^/#/g said the first line in N1-N2 Plus #, does not confirm
N1,n2s/^/\/\//g represents the first line of N1-N2 Plus//, where \ is the escape character

: AB xxxxx yyyyy replace xxxxx with YYYYY

These shortcuts need to be written to the config file, under the user's home. VIMRC

Introduction to package Management
SOURCE package. Source code directly open out of the package, the vast majority of C language written.
Binary package (RPM is the C language compiled format, equivalent to obj), system default package)
Script installation package. The installation interface is written for the source package, and the installation process is similar to the Windows installation package.

For the source package: need to compile the installation, uninstall directly delete files on the line. The installation process is many steps, the compilation process time is long, the installation process once the error novice is difficult to solve.
For binary Packages: Package installation, upgrade, query and uninstall are simple, and the installation speed is fast.

RPM Package Management--rpm Command Management
RPM package naming rules, distinguish the package full name and package name, if the operation is not installed package, must use the package full name, operation if is already installed package, use package name, automatically in/var/lib/rpm Search, installed package will exist/var/lib/rpm under
RPM Package Dependency: The most difficult, so there is yum online management

RPM-IVH Package Full Name installation command
RPM-UVH Package full Name Upgrade command
RPM-E Package name unload command

RPM Query method: RPM-Q Package Name Query package is installed
RPM Query Package Details: RPM-QI Package Name
RPM query for details of packages not installed: RPM-QP Package full Name
RPM Query Package installation location and list: RPM-QL package name
RPM query for packages that are not installed will install the location and list: RPM-QLP package name
RPM Query System file name belongs to which package: RPM-QF System file name
RPM Query Package dependencies: RPM-QR Package Name
RPM query dependencies for packages not installed: RPM-QRP Package full Name

Inspection and extraction of RPM packages:
RPM-V Package Name Check if the files in the package have been changed
Rpm2cpio Package Full Name | Cpio-idv./bin/ls

RPM Package Management--yum Online Management
RPM command management needs to address dependency issues, and Yum online management solves the dependency.
Yum list queries all available packages
The Yum search keyword searches for equivalent packages
Yum-y Install package name (-y automatically if no-y will ask the operator whether to install)
Yum-y install gcc (compiler for GCC C language Linux)
YUM-Y Update package name updates
YUM-Y Update if no package name is added, all software updates to the system
Yum-y Remove Package Name
Yum Grouplist
Yum Groupinstall Group Name

Yum CD as a yum Source:

The difference between the source package and the RPM package
There are two ways to start a service in RPM package installation:
1 Services httpd Start (Services command is centoslinux specific, other Linux possibilities)
2/ETC/RC.D/INIT.D/HTTPD start
The source package is installed to its own specified location, the RPM package is installed to the default location, so the two installation methods start differently:
Absolute path Start

SOURCE Package Installation:
1 Installing the C language compiler--GCC
2 Download the source package

View the install file to see the installation process
Script installation Package
The script installation package is typically used for hardware-driven installations

User Configuration Files
In the/etc/paawd file, save account information, a total of 7 fields:
The file's read and write permissions are not useful to the root user. The UID number is 0 of the user is the root user. 1-499 of the users are pseudo-users and users who are serving the system. 500-65535 ordinary users.
Remove the X, the user does not have the password remote login, can only be local login.

Shell interpreter for normal user/bin/shell if a user is prevented from logging on to change the interpreter to/sbin/nologin

Save the user password string in the/etc/shadow file, a total of 9 fields:
Information about the Save group in the/etc/group file
Each user under Windows defaults to a member under the user group, and each user created under Linux automatically generates a group with the same name and is in this group.
The GID number is 0 of the user is the root user. 1-499 of the users are pseudo-users and users who are serving the system. 500-65535 ordinary users.
The group password is saved in/etc/gshadow

User's home directory
The user's user ID is changed to 0 by entering the/etc/passwd file so that the user is a superuser, but the user's home directory is unchanged and the group can be unchanged.

User's mailbox
/var/spool/mail/User name/
User Templates Directory
/etc/skel/the role of this template, when the new user is added every time, will be the directory of files, copied to the user's home directory, some files are hidden format. We can also include our own files in the template directory, so that each time we create a new user will have their own files.

User Management commands
Add a User: Useradd WDX
passwd WDX
View related profiles: grep wdx/etc/passwd
grep Wdx/etc/shadow
grep wdx/etc/group
grep Wdx/etc/gshadow
Ll-d/HOME/WDX
Ll/var/spool/mail/wdx
To add a password to a user: passwd WDX
passwd Direct Enter is to change the password of their own account, the super User can change the password of all users.
Root user can use Passwd-s wdx to query user password reload
Passwd-l WDX can lock a user, pause a user, the corresponding user password in/etc/shadow plus two exclamation mark
Passwd-u WDX Unlocking a user
For the shadow file permission is 000, the file should be saved as: wq! An exclamation point means to force a save
Use a string as the user password:
echo "123" | passwd--stdin WDX receive string 123 Add password to WDX user


User Default value file
/etc/default/useradd the role of this file when defining a user is to invoke the information in this file, such as home directory: The file is specified in the

/etc/login.defs the role of this file, the definition of the password

Modify user Information Usermod

Usermod-u-c-g-g-u-L user Name
Disable the user's method: 1 Change Shadow file, the password string before adding!! 2 Change the/bin/bash of the passwd file to/sbin/nologin 3 passwd-l user name 4 usermod-l user name

Modify User Password status
Change-l-d-m-m-w-I-E user name
Change-d 0 Root explains that the-D is the option to change the time of the last modification of the password, when it is changed to 0 o'clock, the system thinks that the normal user has not changed the password, so the system requires the user to change the password when logging on.

Delete User Userdel
Userdel-r User name-R deletes user's home directory while deleting users


View User ID
ID User Name

Switch User identities
Su-user name-no less, must have, if the environment variable is not changed after switching, or the environment variable before switching.

Exit back to the account before landing

ENV view operating environment variables for the current operation

Su-root-c "Useradd WDX" action does not switch user to execute command after-C add a WDX user

Add Delete user Group
Groupadd WDX
Groupdel WDX Delete a group inside the user: a group with the initial user, this can not be deleted, error two kinds of additional users, this may be deleted group

Modify a user group
Groupmod-n WDX Cyj Change the CYJ group to WDX Group
Add a user to a group or delete a group
Gpasswd-a User Group (personal recommendation Remember this way, first add the user in the Add Group)
You can also add users directly in/ETC/GPASSWD

ACL permissions
All files have only one user group, user.
Df-h commands for viewing partitions
Dumpe2fs-h/DEV/SDA1 to see if the SDA1 partition supports ACL permissions
The Mount-o remount ACL executes this command within a partition, allowing the partition to have ACL permissions this is temporary
/etc/fstab This is a hardware mount configuration file, see the corresponding partition if it is default, if not, then default,acl save can be permanent

For each file created by the default permissions, permissions only root and owner can change, for each file can have only one user and a group, the user can change their own file permissions, the root user can change the permissions of all files

Getfacl file name
Setfacl option file name
Setfacl-m u: User: Permissions directory or file
Setfacl-m g: Groups: Permissions directory or file

Maximum effective permissions and deletions
Mask is used to specify the maximum effective permissions, and any one user right is the rwx "phase" with mask to derive the user's permissions
Setfacl-m mask:rx file or directory mask permission only for ACL permissions and the permissions of the owning group, does not affect the user's own permissions
setfacl-x u: Delete ACL permissions for user files or directories
Setfacl-x g: Permissions for Group name file or directory delete group
Setfacl-b files or directories directly remove permissions for groups and users

Recursive ACL permissions can only be used for directories
Recursive permissions are directories and all directories and files under the directory
Setfacl-m u: User: Permissions-R directory this way to the current all files are set to the corresponding permissions

This is an important command to implement ACL permissions for future new sub-files.
Setfacl-m d:u: User name: Permission file name only for newly-appearing files

To summarize: There are two ways to modify a file's permissions to a user, one to add the user to the same group as the file, and an ACL rights management mechanism for users and files


File Special Permissions
Features of the setuid:
SETUID: Only binary programs can be executed to set SUID permissions
Command performer to have X permission on the program
The command executor obtains the identity of the program file when executing the program (the owner of the file in the process of executing the program)
Setuid permissions are only valid during the execution of the program, which means that identity changes are only valid during program execution
The passwd command has SUID permissions, so the passwd command can be used by ordinary users to modify the/etc/shadow file, because the shadow file has no permissions for the normal user.
This allows you to understand why passwd can change the password, but the cat command cannot view the shadow file, so the cat command obviously does not have SUID permissions

How to set Suid
4 represents the user's suid
chmod 4755 file 4 represents the ' s ' permission for user rights
chmod u+s file Ibid.
chmod 755 file Removal s permission
chmod u-s file Removal s permission

The Suid permission method is generally used for root user files, plus s permissions, for other users can execute this file can be executed by the root user has the permissions

Setgid for the purpose of the file, only the executable binary program can set sgid permissions, the command executor to the program has the X Execute permission, command execution in the execution of the program, the group identity upgrade to the program files belong to the group. For example, the Locate command,/usr/bin/locate is an executable binary program that can be given sgid, which executes the user lamp on the/usr/bin/locate command.
Permissions, execute locate command, group upgrade to Slocate Group, and Slocate team MLOCATE.DB database has R permissions, all ordinary users can use locate command query mlocate.db
Database, the command ends, the lamp user's group identity is returned as the original group.

Setuid for the purpose of the directory, ordinary users must have R and X permissions on this directory to enter this directory, ordinary users in this directory of the effective group will become the group in which the directory resides.

How to set setuid
chmod 2755 File
chmod g+s File


Sticky bit file special permissions, Sbit mount bit is currently only valid for the directory. Ordinary users only have W and x permissions to the directory, the normal user can have write permissions in this directory, if a directory has sbit permissions, in addition to the root user, other users can create a new file in this directory, but can not delete files created by others.
To set the Sbit method:
chmod 1755 Directory Name
chmod o+t Directory Name
Cancel the adhesive position
chmod 777 Directory Name
chmod o-t Directory Name


Chattr Permissions
chattr [+-=][Options] File or directory
The main options are I and a two options, the file to pay the I attribute is not allowed to delete and rename files, and can not add and modify data, set the I property for the directory, you can only modify the files in the directory data, but do not allow the creation and deletion of files, this command for Root also applies. A property is for file settings, so you can only add data to a file, but you cannot delete or modify the data, and if you set a property on the directory, only the file is allowed to be created and modified in the directory, but it is not allowed to be deleted.

Lsattr options file or directory view chattr properties
Option A, view the Chattr property of the directory or file

sudo permissions
Root gives ordinary users a command that can only be executed by a super user.
Sudo action object when system command

The command is Visudo executed when the/etc/sudoers file is modified root all= (all) all
User name managed host address = (can use Identity) Authorization command (absolute path)
Example: In the sudoers file add Wdx all=/sbin/shutdown-r now where all is equivalent to the IP of this machine is the server with Linux, that is, the IP is managed host IP, not the source IP, this comparison around.
Then SU-WDX can then not directly use shutdown through sudo-l to see what the current user has been given by root for sudo permissions if you want to execute the shutdown command,
Sudo/sbin/shutdown-r now

File partitioning and file system
The primary partition can only have four, the extended partition can only have one, the primary partition plus the extended partition up to four, but the extended partition cannot store data and formatting, must be divided into logical partitions to use, logical partitions are divided in the extended partition, IDE hard disk, Linux up to 59 logical partitions, SCSI hard disk Linux supports a maximum of 11 logical partitions.
One problem to note here: Logical partitions generally always start with sda5, and sda1-4 can only be used for primary and extended partitions.

CENTOS6 supported file systems are EXT4,EXT4 supported storage large file operation speed


File system commands
DF View partition Condition Df-h humanized display
ll view directory is not the size of all the files in the statistics directory, only the current directory of all the file name occupied space
Du-s statistics file size and is only the size of the file, the size of DF statistics including file-related processes such as the size of the occupation, these two size contrast, you can know whether to restart the system, restart the end of useless process.

fsck[option] Partition device file name this does not require artificial use, the system itself uses this command.
DUMPE2FS command mainly see block size (format to produce small partition, partition size, usually 4KB) partition whether the default ACL permissions

Query and Auto Mount
Mount-l display devices that are already mounted on the system
Mount-a automatically mount content based on profile/etc/fstab is only re-mounted on an existing partition
Mount [-t system system] [-L volume label name][-o Special Options] Device file name mount point
One of the special options in-O is to prohibit this partition from executing an executable program

Mounting Discs Mount-t Iso9660/dev/cdrom/mnt/cdrom
Uninstall command umount device file name or mount point (Note that the mount point cannot be unloaded at the mount point)
Mount USB fdisk-l View USB drive device filename The name of the USB flash drive is related to the current system hard drive, so you need to view the current device
Mount-t VFAT Device mount point (Linux default does not support NTFS file system, Apple System because it is the Linux kernel so Apple often does not support u disk drive, etc.)

NTFS file system support
The Linux system itself has a lot of drivers, which basically can support the whole computer's operation.
One way to get Linux to support NTFS is to install the NTFS driver, which requires recompiling the entire Linux kernel.
Another way to download a ntfs-3g plugin, unzip the tar-zxvf file ....

Add a hard disk, partition
Fdisk/dev/sdb
Mkfs-t EXT4/DEV/SDB1

Summary: the disc and the U disk and the mobile hard disk itself has a file system, the computer can be plugged into the computer to identify the various partitions, but the need to mount the various partitions to the Linux system, the corresponding hard disk has a file system mounted on it. The hard disk needs to be partitioned and then reformatted before it can be used.

But it disappears after the computer restarts. It is therefore necessary to implement automatic mounting:
Fstab file for automatic partition mount and repair:
Each partition will have a last-found directory, which functions as a backup point for automatic partition backups.
To implement an automatic mount in the Fstab file, follow the other partition record format to write it.
If the wrong fstab for the new hard drive, the first is to follow the prompts to enter the system, at the same time need to pay attention to the error after mounting the root partition when the default is read-only mount (mount-o ro view mount command special options) so if you want to modify the FSATB file needs to be re-mount the root partition is specified as RW permissions.


GCC is a very important source code compilation tool under the Linux operating system and has many important options to support the compilation of many different languages, such as C, C + +, Ada, Fortran, Objective, Perl, Python, Ruby and Java, etc. Even Linux's many kernels and many other free software and open source applications are written in C and compiled by GCC.

1. Compiling a single source file

[For example] print "Hello,linux." On the screen. Ex

[Source code]

#include <stdio.h>

#include <stdlib.h><

int main (int argc,char **argv)

{

printf ("hello,linux.\n");

Exit (0);

}

Save the source file as hello.c and start compiling

$GCC-O Hello hello.c

After the compilation completes successfully, under the current path, generate a file with the name Std Hello and execute

$./hello

On the screen, you will see the results of the printing: Hello,linux.

Note: By default, after the compilation completes successfully, a file named A.out is generated under the current path, and then the $./a.out can be printed, but you can usually specify your own executable name by using the option-O.

2. Compiling multiple source files

3. Using an external function library

4. Using shared function libraries and static function libraries

5.GCC Options Detailed description

Linux Basic 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.