HP-Unix

上一篇 / 下一篇  2010-03-25 21:59:17 / 个人分类:linux

1,useESCkey to fill out file name or directory on UNIX.Another one, use Tab key to fill out file or directory name on linux.

2,useqkey to switching to command identifier

3,if the command identifier is #,the role of login is root user. if the command identifier is $, the role of loginis common user.

4,usefindcommand to search file or directory. for detail,just using command: man find.

5,usegrepcommand to search text in one file. e,g: grep (text) filename.

  grep -i file->don't case sensitive to find text

  grep -l file->just list full match file.

  grep -L file->list unmatch file

  grep -w file->match full words but not a part of string.

  grep -c file->match context and display row number.

6,usecolcommand to output text to another file.e,g: ls test|col -b >explain.doc

7,usewhichcommand to display absolute path.

8,useshow_patches command to display patch detail for installed patch.

9,uselocale-a to display language characters with current system.

10,useecho$environment variables to display value or use ls/cat $environment variables.

11,usetopto display system progress.

12,usepsto display current process.

       ps aux command to display the owner of the processes along with the processes.

       ps ax|grep process-U-want-to see //To see if a particular process is running or not. For this purpose you have to use ps command in combination with the grep command e.g:ps ax|grep httpd

                        pstree to display a tree of processes.

13,if examine system log, just switching to /var/adm/syslog and check text.

    for shutdownlog, directory:/var/adm/shutdownlog

    for sna.err, direcotry:/var/opt/sna/sna.err

    for net.log directory:/usr/sbin/netfmt/var/adm/nettl.LOG000>net.log

    for login info,directory:/var/adm/btmp

    for startup info, directory:/etc/rc.log

    for install/delete software,directory:/var/adm/sw/

14,usewho-r to display init level for current system.

15,uselastb-R to display login faild log.

16,useftpcommand to test ftp whether install successfully.

17,usesvncommand to test svn whether install successfully.

18,if modify network config,just modify file by directory /etc/rc.confg.d/netconf

19,usefingercommand to display logon info with common user.

20,usechmod777 to add r-w-x right for one file or directory.

   chmod +r/w/x

   chmod -r/w/x

   chmod -R  file/directory  ->use the same right to chage current file or directory.

   chmod -v   display chage history detail

   chmod -f   if can't modify right but don't display error info.

   chmod -c   if the file was modified,the outcome will display change history.

21,use sh file(shell file) or ./file(shell file) to execute shell script.

22,use gedit command to open text Editor like as notetext on window and use this command to modify file content.

23,usemvfile directory to move file to new position.

   use mv original file name  new file name to rename file.

   mv -l file -->prompt whether move file.

24,input#!to represent comments in VI editor.

25,useechocommand to display content on screen.

26,useclearcommand to clear screen.

27,usereadcommand to get input from keyboard.

28,uselsto list file or directory.

    ls -l display file detail.

    ls * ->show all files.

    ls a* ->show all files whose first name is staring with letter 'a'

    ls *.c ->show all files having extension .c

    ls ut*.c ->show all files having extension .c but file name must begin with 'ut'

    ls ? ->show all files whose names are 1 characters long

    ls fo? ->show all files whose names are 3 characters long and file name begin with fo.

    ls [abc]* ->show all files beginning with letters a,b,c

    ls /bin/[a-c]*

    ls /bin/[!a-o]

    ls /bin/[^a-o]

    ls / -R | wc -l

This command will take lot of time to search all files on your system. So you can run such command in Background or simultaneously by giving command like

    ls / -R | wc -l &
The ampersand (&) at the end of command tells shells start process (ls / -R | wc -l) and run it in background takes next command immediately.

29,usewhocommand to display current login user info.

30,usepwdcommand to display current path.

31,use<or>to import content or export data.e,g: cat <test, cat >test

32,usedateto display current system date and time.

33,use>>command to save output result to else file like as : ls -l >> test.txt

   note that if execute this command agani, the previous content don't deleted while increase one record in test.txt but the > command will cover previous content.

34,Usetr command is used to translate all lower case characters to upper-case letters. It take input from sname file, and tr's output is redirected to cap_names file.

               $ tr "[a-z]" "[A-Z]" < sname > cap_names
               $ cat cap_names

35,usetailcommand displays the last few lines of a file. Likehead, it can save you time, because it's a lot quicker than calling up a file with a text editor and scrolling all the way down to the bottom. By default, tail will show the last ten lines of a file, but you can also tell it how many lines to display:

tail some.file Show last ten lines of s ome.file.
tail -3 some.file Show last three lines of some.file.

36,Usesortcommand to sort every rows for one file.
37,Useuniqcommand to remove duplicate lines.i.e. keep distinct content to shows unique.

38,usekill{PID} command to stop any process e.g:kill 1012

       killall{process-name} to stop processes by name e.g:killall httpd

       kill 0 to stop all process except your shell.

39,Usepasswdto change your current password  

40,Usemoreto read the contents of a file

41,Usenanoto start a text editor

42,Usedfto check disk space

43,Useducommand prints a summary of the amount of information you have stored in your directories on the  mounted disks.

44,use ENV command to display all environment variables for current system. 

45,usecsh- executes and runs the C Shell if present

46,use logname - would return the name of the user currently logged in

47,sh- Executes the Bourne shell, likely taking you to a $ prompt

48,bc cal.txt= Would result in 3, see below notes.

Within the cal.txt file you could have a simple statement such as:

  /* Add the value 1+2 /*
  1+2
  quit

49,dc- Enters the desk calculator, below is a short example of what can be done:

1234- Enter base value of 1234
1234
2 * p- Takes the value of 1234 times 2 and prints value
2468
468- p - Takes the value of 2468 and subtracts 468
2000
2 / p- Takes the value of 2000 and divides by 2.
1000
v p- Takes the value of 1000 and square roots it.
31
q- Quits the desk calucator

50,Short for Aho, Weinberger, and Kernighan, awk is a script. processing language also known asoawk, gawk, mawkandnawkallows for pattern scanning and processing.

51,use newgrp command to Log into a new group.

52,use set/setenv command in C shell sets the value of an environment variable.

53,use stty command to Sets options for your terminal.

54,use tabs command to Set tabs on a terminal.

  tabs -a- using -code ( canned specification) to set tabs to the settings required by the IBM assembler: columns 1, 10, 16, 36, 72

55,use less filename to display text content.

56,use mkdir directory to create one directory.

57,use rm filename to delete file and use rmdir command to delete direcotry.

58,use chdir directory command to switching to else directory.

59,use ac -d -y command to prints statistics about users' connect time.

60,use netstat command to display network status.

netstat

Displays generic net statistics of the host you are currently connected to.

netstat -an

Shows all connections to the server including the source and destination ips and ports if you have proper permissions.

netstat -rn

Displays routing table for all ips bound to the server.

netstat -an |grep :80 |wc -l

Display the amount of active connections onport80. Removing thepipeandwc commandwould display each connection.

netstat -natp

Display active Internet connections. Seedocument CH001079for an example of output.

61,use wc file/directory to displays a count of lines, words, and characters in a file.

  wc myfile.txt - Displays information about the file myfile.txt. Below is an example of the output.

5    13    57   myfile.txt

5 = Lines
13 = Words
57 = Characters

62,The "ifconfig" command allows the operating system to setup network interfaces and allow the user to view information about the configured network interfaces. 

ifconfig eth0

View the network settings on the first Ethernet adapter installed in the computer.

ifconfig -a

Display info on all network interfaces on server, active or inactive.

ifconfig eth0 down

If eth0 exists would take it down causing it cannot send or receive any information.

ifconfig eth0 up

If eth0 exists and in the down state would return it back to the up state allowing to to send and receive information.

ifconfig eth0 192.168.1.102 netmask 255.255.255.0 broadcast 192.168.1.255

Assign eth0 with the above values forIP,netmaskandbroadcastaddress.

63,

Manipulate the systemARPcache.

Syntax

arp [-vn] [-H type] [-i if] -a [hostname]

arp [-v] [-i if] -d hostname [pub]

arp [-v] [-H type] [-i if] -s hostname hw_addr [temp]

arp [-v] [-H type] [-i if] -s hostname hw_addr [netmask nm] pub

arp [-v] [-H type] [-i if] -Ds hostname ifa [netmask nm] pub

arp [-vnD] [-H type] [-i if] -f [filename]

64,use route command to show / manipulate the IP routing table.

route -n

Shows routing table for all IPs bound to the server.

route add -net 192.56.76.0 netmask 255.255.255.0 dev eth0

adds a route to the network 192.56.76.x via "eth0". The Class C netmask modifier is not really necessary here because 192.* is a Class C IP address. The word "dev" can be omitted here.

route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0

This is an obscure one documented so people know how to do it. This sets all of the class D (multicast) IP routes to go via
"eth0". This is the correct normal configuration line with a multicasting kernel.

65,rpcinfo- Would display the rpc information of the host you are currently connected to.

66,use exit command allows you to exit from a program, shell or log you out of a Unix network.

Note:If exit does not log you out you can also do logout, lo, bye, quit, also Ctrl-D may work.

67,Uses thetelnetprotocol to connect to another remote computer.

telnet host.com- Would open a telnet session to the domain host.com

68,use alias command commonly used for a long strings that are frequently used. Alias allows you to have a small more familiar command or name to execute a long string.

alias home 'cd public_html'- Sets home to type cd public_html

69,use w command to Displays information about the users currently on the machine, and their processes. The header shows, in this order, the current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes.

70,use whereis file to locate a binary, source, and manual page files for a command.

whereis -u -M /usr/man/man1 -S /usr/src -f *

In the above example the whereis command would search for any manual for any file in the current directory.

whereis perl

Locate the directories for where Perl is stored.

 


TAG:

 

评分:0

我来说两句

我的栏目

日历

« 2024-05-09  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 5311
  • 日志数: 8
  • 建立时间: 2009-05-05
  • 更新时间: 2010-04-05

RSS订阅

Open Toolbar