1. Modify the IP address
Ifconfig + port number + IP/netmask start Nic ifconfig etho up or restart all interfaces service networking start to view current route-N plus gateway route add default GW xxx2, use apt-cache to find the latest software package
For example, to install gcc
Sudo apt-cache search GCC.
In the list, we found that the gcc-4.3 is the latest GCC version.
3. Use apt-get to find the latest software package.
Sudo apt-Get install gcc-4.3. force update sudo apt-get-F install gcc-4.3. update Software source list sudo apt-Get updateupdate software apt-Get dist-upgrade example: Install gnome apt-Get install x-window-system-core
Apt-Get install gnome-desktop-Environment apt-Get install gnome ---------------------- list libnl-3-200 in localapt-Cache show libnl-3-200
Aptitude show libnl-3-200
If installed then the result will show: installed-size: 154
If not installed then the result will show: State: Not installed4, create a hyperlink
If the current Linux has an earlier version of GCC, you can directly link the GCC command to the gcc-4.3. The command line is as follows:
Sudo ln-S/usr/bin/gcc-4.3 gcc
5. Both env and export display the current environment variable.
6. display the current shell environment variable
Echo $ shell if the output result is/usr/local/bin/bash, write "#! /Usr/local/bin/bash ", which means the sh file uses the shell environment variable of the system. Note: 1> The. Sh file only calls the first line of shell environment variables when it is set to an executable file and executed directly. Step: chmod + x. sh. sh 2>. if you use the source command to directly execute this file, the first line of shell environment variable source is not called .. /. the SH7 and grep commands grep are used in Linux to search for the content contained in the output content.
1> for example, if you want to search for a string of characters "BBB" in aaa.txt, you can use
Cat aaa.txt | grep bbb
2>. You can use
Ls | grep BB 3>. search all the files in the current folder that contain the string "manager" grep "manager"-Rn * 4> CAT/etc/group | grep fuse to find the/etc/group file, and directly search for the fuse string 8. APT-Get autoremove xxx can automatically delete all software related to a software. If you want to delete vim and install a new version of APT-Get autoremove Vim apt-Get autoremove vim-tiny, then apt-Get install vim-full will complete Vim installation.
9. APT-Get update can also update a single package, for example, Apt-Get update apt-get, to update itself. 10. Edit the vim Development Environment Vim _ vimrc11 and Vim. bashrc + 28 open the file and go to row 12 on line 28 to edit the environment variable. profile file, which must be logged out and then logged into the environment variable to take effect. The more convenient method is source. profile, and the new environment variable takes effect immediately. Note that you must use/bin/Bash to call the. profile file immediately after logon. If other Bash (such as/bin/sh) is used, it will go to/etc/passwd and change it to/bin/bash under your own user .. the profile file is the entry to the system environment variable, which is called. bashrc ,. vimrc. 13. Echo $ path: view the current environment variable echo $ shell: view the current Shell
14. ln-S/usr/sbin/tcpdump/usr/bin/tcpdump creates a link named/usr/sbin/tcpdump. The actual source file points
/Usr/sbin/tcpdump
Rm-RF/usr/sbin/tcpdump
15. Vim forces WQ to be saved! 16. Add the user adduser username passwd passwd17, after adding a user to a group groupadd username groupname, check the/etc/group file Vim/etc/group to see if the user has been added to a group of 18, view the help info groupadd and groupadd -- help of a command. Man groupadd is used to view manual 19, ssh-u <usrname >@< host>-P <port> 20, chown-r <group name >:< User Name> * recursively sets permissions (all files in the current folder) chgrp <username>/<File Name> modify the group to which the file belongs, for example, chgrp staff/home/CAT 21. The value assignment statement in Shell shell cannot contain spaces, such as Foo. = 1 there is no error at runtime, but Foo = 1 will report an error at compilation.
However, in [], there must be enough distance between the statements.
For example, if [$ answer = "yes"]
If it is written as if [$ answer = "yes"], an error is reported during execution.
22, man hier
View the file directory structure of Linux
23. OpenSSL version-
View OpenSSL version
24. How to query the NIC address of an IP address in the LAN
Ping 10.139.44.121. At this time, the local ARP record the ping process.
Then, run ARP-a to query the MAC address of 10.139.44.121.
25. view the kernel version
[Admin @ mall_dev4 ~] $ CAT/proc/version
Linux version 2.6.9-67. elxenu (brewbuilder@ls20-bc1-14.build.redhat.com) (GCC version 3.4.6 20060404 (Red Hat 3.4.6-8) #1 SMP wed Nov 7 14:19:15 est 2007
[Admin @ mall_dev4 ~] $ Uname-
Linux mall_dev4 2.6.9-67. elxenu #1 SMP wed Nov 7 14:19:15 est 2007 i686 i686 i386 GNU/Linux
26, find command
Find./-name * 99 *-n-R
28. mount an RMB folder
Sudo Mount-o User = Awang, uid = Awang // <ip>/Andy. Wang/UTM/mainline/home/Awang/UTM/mainline
29. view the last 2000 syslog messages.
Tail-N 2000/var/log/syslog
30. modify the system startup level file
VI/etc/inittab
31. Check interface phisical states by ethtool
Ethtool eth0
32. debug shell command: (Sh-x)
Sh-x networking start
33. tcpdump
Tcpdump-Ni eth0 ICMP
# Check DHCP packages and print the link-level header on eaach dump line.
Tcpdump-Ni eth0 UDP port 67 or 68-EV
34. Man A Function
Man snprintf>/tmp/snprintf. Man
35. Man a configuration file
E.g. Man syslog configuration file In Debian
Man rsyslog. conf
35. Man man
Check how "man" Works
36. "ip" command
1) show all MAC address
IP maddr show
2) show all link
IP link show
3) show all address
4) show all IPv6 neighbors
IP-6 neigh show
5) add an IPv6 ADDR
Usage:
# /sbin/ip -6 addr add <ipv6address>/<prefixlength> dev <interface> |
Example:
# /sbin/ip -6 addr add 2001:0db8:0:f101::1/64 dev eth0
6)
Using "ifconfig"
Usage:
# /sbin/ifconfig <interface> inet6 add <ipv6address>/<prefixlength> |
Example:
# /sbin/ifconfig eth0 inet6 add 2001:0db8:0:f101::1/64 |
37, ls
Ls-LH/tmp/DHCP displays the file size in MB.
38. Memory State
CAT/proc/meminfo
30, ethtool ATH0
Use ethtool to check the state of interface.