Linux Basic Operating notes

Source: Internet
Author: User
Tags disk usage file permissions lost password

1, Linux is a collectively, the kernel is consistent. It is divided into Linux system administrators and Linux programmers including management and software development.

2, to Master Linux, there are four steps, first, on the Linux platform development, such as, VI, GCC, GDB and other basic Linux-related operations; second, C language Foundation; third, advanced programming in the Linux environment; Linux application system development or embedded development.

3, reference books, first know how to do, in to explore why do so; appropriate swallowed;

4, features, first, open source, free, second, security, third, multi-threading, multi-user, IV, memory and management have their own characteristics. Running memory requirements are small, can do embedded development.

5, IBM and Redhat, almost all big software companies support Linux, except Microsoft, the Outlook is good.

6, StartX is to enter the graphical interface, click Logout to enter the command line interface.

7, shut down-h now shutdown, reboot reboot (both to have root privileges)

8, VI compiler use: 1, enter; 2, start knocking code, HELLO,C;3, End with ESC, enter command mode, then ... To play with myself.

9, the role of the root directory of Linux needs to understand, its root directory is like Windows C disk, CD/can switch to the root directory, and then use LS to see the root directory. For example,/bin: Store the most commonly used commands;/root system Administrator's home directory (hehe, privileged Class);/sbin: System administrator command to store directory;/boot: Start Linux core file;/etc: Store various configuration files;/var some large file overflow area, For example, log files for various services;/home: Directory of the owner;

10, PWD can display the current directory under which to avoid getting lost

11, in the root can add users,useradd user name, plus password, passwd password; Userdel user, for delete user, just delete user name, inside things can be preserved, and Userdel-r user name, The user and the contents of the file are deleted.

12, init command, RunLevel, #0 shutdown, #1 single-user mode, #2 multi-user mode but no network services (NFS), #3 full user mode, that is, multi-user + network services (commonly used), #4 not used, #5 graphical interface (too CPU-free, general use), #6 system restart, Will enter the restart infinite loop (do not play this), if entered, after entering the boot interface, quickly press E, select the second line, and then press E, enter after the level can be changed, can only enter 1, can not enter other numbers, enter the single user mode, and then to change to the level you want, here is a loophole, You can also change the password, that is, you can change the password without entering the original password, that is, you can use this method to retrieve the lost password. In addition, this command and runlevel can be changed only under root, enter the method as Vi/etc/inittab, and then change the default value. In addition logout and SU (can be switched from a normal user to the root user, need a password, and the root user switch to the normal user directly SU user name can be, without password. ) is the Switch User command (you can enter the user name directly, and then enter the password).

13, touch to create an empty file, cp,mv,ln and so on; More is in the file list is particularly many cases of page display, with a space to scroll down the keys, with ctrl+pageup to page up; | For the pipeline command, the previous command results to the following command processing, grep find text in the keyword,grep "keyword" filename , there are some parameters, used to re-check. The Man command, the Find command, uses the Find/-name file name. where/is the root directory. However, you should specify a small directory to find, otherwise too slow, there are many parameters, self-check. > This command is magical, called pipe-directed commands, such as

Grep-n "Key Information" A.txt>b.txt

It means that the key information found in A.txt is saved to B.txt, if it is not b.txt, create it and then save it, if there is, cover the contents of the key information for this search,>> This command is superimposed and not overwritten.

14, the file suffix does not make much sense, the focus is the file content header file of a byte identifier.

15, How to build c/java/c++ under Linux development environment? Gcc

16, a user must be in one or more groups (user group ), not independent of the group, the owner of the file, who created the file, who is the owner of the file, the file is the group is the user's group. Ls-ahi can see the group in which the file is located. to have root privileges. In order to create groups and users.

17,-rw-r--R--, the first representative of the file type, the second paragraph represents the owner of the document's permissions, divided into three kinds, r for the readable, 4, 2,W representative writable, with 2 identification, 3,x for the executable permission, 1; The third paragraph represents the user's permissions to the file in the same group. The last paragraph represents the permissions of the other group's users on the file.

Note that18-19 requires root privileges.

18, chmod Modify the permissions, chmod 777 folder, this can only modify their own file permissions, can not modify the rights of others, of course, except root, it is omnipotent. 7 means to say 1+4+2=7, so open R, W, x permissions, everyone can see, if it is 770, then other groups of users can not see. Another way to change permissions is chmod u=rwx go=rx file name, U is the owner of the file, the user, G is the group user groups, O is others other groups; plus, + and-thought to add and remove the meaning, = set to.

19, uaermod-d group name 2 user Name 1, that is, the user 1 is reassigned to this group name 2, of course, only the superuser can use this command, the user himself and others can not be used.

Linux partition , a hard disk divided into basic partitions and extended partitions , the sum of which can not be greater than 4, thebasic partition can be used immediately but no longer partition, the extended partition must be partitioned before use, The extended partition is then partitioned into logical partitions, and the number is unlimited.

The primary partition (C- drive ), and the extended partition is then partitioned into logical partitions (d,e,f disks ). Fdisk-l View The specifics of the Linux partition. Dev represents the device,SD represents a hard disk (SCSI hard disk), there are generally two, there is a kind of called IDE hard disk, SD hard drive better. A1 represents the first partition of the first hard disk ... Look at the picture!

DF Directory full path, see in which partition this directory, that is, to see which partition is attached to this directory;unmount directory, to interrupt this mount relationship, is to unload this partition by using LS to see anything. mount partition directory, that is, to mount the partition to this directory (this directory is like a shortcut to this partition). Linux is the mount mechanism.

DF to View disk usage. df-h

in the Linux with a Samba server, you can upload files on Windows to Linux , Downloading SSH on Windows also enables file transfer between two systems.

21, Shell Introduction , Popular speaking, is the command and the Linux kernel between a translation officer, because the linux kernel can not understand the command line we entered, so The shell acts as a translator, a logical process that can be called a translator. Of course, this is just one aspect of the shell , and he can also be used for programming, similar to a dos batch file. ls-l/bin/*sh can view (total three categories)

To see which Shell is currently used ,use the env command to display the current operating system's environment variables,env | more, segmented view;

Modify the shell type,chsh-s/bin/root can only;

22, export ps1= "\e[35m[[[email protected" ~]$\e[0m " This can change the color.

23. CAT/ETC/PASSWD can see which shell he is using .

24, the process is the execution of the program, the thread is a lightweight process, the process has a separate address space, the thread is not, the thread cannot exist independently, is created by the process. In contrast, threads consume less CPU and memory than processes.

25, Ps-aux generally used together, the information is more complete;kill Process number kill-9 process number is force kill! The Kill all process number kills the process number and its child processes.

26, the top command can be real-time dynamic view of the overall operation of the system, is a comprehensive multi-party information monitoring system performance and operational information of the utility tool .

27, Shell script writing

28, the use of makefile

29, relative path and absolute path, current directory pwd, working directory. relative path , starting from the current directory, go to access the target directory (file), absolute path , is to access a directory (file) from the root directory (/). The working directory is the default directory.

30, Ln-s source target file shortcut. is a way of linking

31, Shell script,Shell 's use.

32, Ls-l Abc[1-6].txt is to find abc!. TXT file, which ! Representative 1 to the 6 of a number.

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