C Programming series in linuxl-basic knowledge and basic commands

Source: Internet
Author: User

C development in Linux
Editor: vi
Compiler: select the gnu c/C ++ compiler gcc
Debugger: widely used GDB
Function library: glibc
System header file: glibc_header

To develop a graphical interface, you also need to choose gnome (C)/KDE (C ++) software development.
IDE: (most people still use GCC directly)
Kylix: dephi in Linux
Kdevelop
Rhide: similar to Turbo C ++ (rarely used)

To build a complete C development environment, glibc is essential. It is the main function library of C in Linux.
Glibc2 includes several additional packages: linuxthreads, locale, and crypt
Glibc is a C library that provides system calls and basic functions, such as open, malloc, and printf. It is used by all dynamically linked programs.

If the system header file (glibc_header) is missing, many C Programs that use system functions will not be able to compile

The GCC package depends on binutils and CPP packages, and the make package is also commonly used. Therefore, a total of 8 packages are required for installation:
CPP. rpm
Binutils. rpm
Glibc. rpm
Glibc-kernheaders.rpm
Glibc-common
Glibc-devel.rpm
Gcc. rpm
Make. rpm

Basic commands

View the glibc version:
Ls/lib/libc -*
Check the GCC version.
GCC -- version

Control start mode/etc/inittab
Shutdown-H now
Restart shutdown-R now
Stop system init 0 halt poweroff Shutdown
Restart system init 6 reboot
Start init 3 on the text interface
Enable init 5 on GUI
Single User Mode init 1

Your default home directory/home/Username
Useradd username create new user
Passwd username add Password

Loading of Optical Drive
Mount-T iso9660 (Omitted)/dev/CDROM/mnt/CDROM
Uninstall (develop habits)
Umount/mnt/CDROM
Use of cloud drive
Mount-T fstype/dev/fd0/mnt/floppy
Fdisk-L [/dev/had] Hard Disk Partition status
DF-H hard disk partition usage
Space occupied by the Du-SH directory
Linux version used by uname-
Mkdir create directory
Rm-r-F recursively deletes directories without prompting
Rmdir Delete empty directory
PWD View Current Directory
CD switch directory
Ls View File-A (all, including hidden files)-L (detailed)-R (recursive display)-D (non-recursive)
More less file name View File Content
Cat display file content
MV (SRC) (DST)
CP-F (Direct Overwrite)-I (prompt)-R (recursive) (SRC) (DST)
Man command to view the command manual page
Info command to view Command help
Command-help

When the system is shut down abnormally, it may not be able to enter the system. This is to perform fsck to repair the disk.

For example, fsck-p-t ext2/dev/hda2

File

File Type
Common files (-): text files and binary files
Directory file (d): The Directory is also a file
Special files: block Device Files (B) and character device files (c ). Soft link (shortcut) and hard link (file copy), and MPs File

Find path. If the path is not specified, it indicates that-name-size-tpye is searched from the root directory.
Locate search
Grep [Option] search mode file name // match search
-N: display the matching row number
-I case-insensitive
-R recursive search

File directory permissions
Rwx (read, write, execute)
Chmod changes File Access Permissions
Chmod (ugoa) (+-=) (rwx) filename (U owner, G group, O other users, all users of)
-RW-r --
The first one indicates the file type (-indicates a common file)
The next nine objects indicate the object owner, the owner's permissions in the group, and other users. Three-digit representation

Diff identifies the differences between two text files
CMP compares any two files

Network, packaging, compression, processes, pipelines, and other commands

Ifconfig: equivalent to ipconfig in Windows
Ping:
Netstat> a.txt redirects the network to the.txt File

Run the rpm-Qi A. RPM command to check whether a. rpm is installed.
Rpm-ivh a. RPM install a. rpm

Tar for packaging and Compression
The tar-CVF a.tar/home package is a.tar.
Unpack tar-xvf
Tar-tvf View package content
Package tar-czvf a.tar.gz/home and compress the directory a.tar.gz.
Tar-xzvf a.tar.gz unlock

View the current process PS
Delete the process kill PID

CTRL + C force exit
Find/etc-name passwd (with an &, it will run in the background)

Time find/etc-name passwd time used

Ls-L/etc | more paging (Space/press Enter next page, | pipeline)

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.