Вы находитесь на странице: 1из 6

1.

Run levels
http://www.tldp.org/LDP/sag/html/run-levels-intro.html

A run level is a state of init and the whole system that defines what system services are operating. Run levels are identified by numbers. Some system administrators use run levels to define which subsystems are working, e.g., whether X is running, whether the network is operational, and so on. Others have all subsystems always running or start and stop them individually, without changing run levels, since run levels are too coarse for controlling their systems. You need to decide for yourself, but it might be easiest to follow the way your Linux distribution does things. The following table defines how most Linux Distributions define the different run levels. However, run-levels 2 through 5 can be modified to suit your own tastes. Run level numbers
0 Halt the system. 1 Single-user mode (for special administration). 2 Local Multiuser with Networking but without network service (like NFS) 3 Full Multiuser with Networking 4 Not Used 5 Full Multiuser with Networking and X Windows(GUI) 6 Reboot.

Services that get started at a certain runtime are determined by the contents of the various rcN.d directories. Most distributions locate these directories either at /etc/init.d/rcN.d or /etc/rcN.d. (Replace the N with the run-level number.) In each run-level you will find a series of if links pointing to start-up scripts located in /etc/init.d. The names of these links all start as either K or S, followed by a number. If the name of the link starts with an S, then that indicates the service will be started when you go into that run level. If the name of the link starts with a K, the service will be killed (if running).

2: wtmp and utmp files contain ?


User login-logout log

3 File permissions
http://www.cyberciti.biz/faq/how-linux-file-permissions-work/

A: Linux Read mode permissions


Read access on a file allows you to view file Read access on a directory allows you to view directory contents with ls command

B: Write mode permissions


Write access on a file allows you to write to file Write access on a directory allows you to remove or add new files

C: Execute mode permissions


Execute access on a file allows to run program or script Execute access on a directory allows you access file in the directory

D: Octal numbers and permissions


You can use octal number to represent mode/permission:

r: 4 w: 2 x: 1

For example, for file owner you can use octal mode as follows. Read, write and execute (full) permission on a file in octal is 0+r+w+x = 0+4+2+1 = 7 Only Read and write permission on a file in octal is 0+r+w+x = 0+4+2+0 = 6 Only read and execute permission on a file in octal is 0+r+w+x = 0+4+0+1 = 5 Use above method to calculate permission for group and others. Let us say you wish to give full permission to owner, read & execute permission to group, and read only permission to others, then you need to calculate permission as follows: User = r+w+x = 0+4+2+1 = 7 Group= r+w+x = 0+4+2+0 = 6 Others = r+w+x = 0+0+0+1 = 1 Effective permission is 761.

4: How to compares files, and shows where they differ


diff filename1 filename2

5: How to check how many lines, words, and characters there are in a file
wc filename ---

5: ABOUT OTHER PEOPLE

w --- tells you who's logged in, and what they're doing. Especially useful: the 'idle' part. This allows you to see whether they're actually sitting there typing away at their keyboards right at the moment. who --- tells you who's logged on, and where they're coming from. Useful if you're looking for someone who's actually physically in the same building as you, or in some other particular location. finger username --- gives you lots of information about that user, e.g. when they last read their mail and whether they're logged in. Often people put other practical information, such as phone numbers and addresses, in a file called .plan. This information is also displayed by 'finger'.

ABOUT YOUR (ELECTRONIC) SELF


whoami --- returns your username. Sounds useless, but isn't. You may need to find out who it is who forgot to log out somewhere, and make sure *you* have logged out. finger & .plan files of course you can finger yourself, too. That can be useful e.g. as a quick check whether you got new mail. Try to create a useful .plan file soon. Look at other people's .plan files for ideas. The file needs to be readable for everyone in order to be visible through 'finger'. Do 'chmod a+r .plan' if necessary. You should realize that this information is accessible from anywhere in the world, not just to other people on turing. passwd --- lets you change your password, which you should do regularly (at least once a year). See the LRB guide and/or look at help password. ps -u yourusername --- lists your processes. Contains lots of information about them, including the process ID, which you need if you have to kill a process. Normally, when you have been kicked out of a dialin session or have otherwise managed to get yourself disconnected abruptly, this list will contain the processes you need to kill. Those may include the shell (tcsh or whatever you're using), and anything you were running, for example emacs or elm. Be careful not to kill your current shell - the one with the number closer to the one of the ps command you're currently running. But if it happens, don't panic. Just try again :) If you're using an X-display you may have to kill some X processes before you can start them again. These will show only when you use ps -efl, because they're root processes. kill PID --- kills (ends) the processes with the ID you gave. This works only for your own processes, of course. Get the ID by using ps. If the process doesn't 'die' properly, use the option -9. But attempt without that option first, because it doesn't give the process a chance to finish possibly important business before dying. You may need to kill processes for example if your modem connection was interrupted and you didn't get logged out properly, which sometimes happens. quota -v --- show what your disk quota is (i.e. how much space you have to store files), how much you're actually using, and in case you've exceeded your quota (which you'll be given an automatic warning about by the system) how much time you have left to sort them out (by deleting or gzipping some, or moving them to your own computer). du filename --- shows the disk usage of the files and directories in filename (without argument the current directory is used). du -s gives only a total. last yourusername --- lists your last logins. Can be a useful memory aid for when you were where, how long you've been working for, and keeping track of your phonebill if you're making a non-local phonecall for dialling in.

6: Change Date & Format:


date -s "2 OCT 2006 18:00:00"

You can also simplify format using following syntax:


# date +%Y%m%d -s "20081128"

7: How do you find how many cpu are in your system and there details?
> Method:1 > cat /proc/cpuinfo > Method:2 > lscpu

8: How to change IP address on Linux via command line ?


A: by command: # ifconfig eth0 192.168.0.1 netmask 255.255.255.0 But its we be erased when you will restart network. For Permanent IP addr Change edit the eth conf file: # vi /etc/sysconfig/network-scripts/ifcfg-eth0 an Example below:
DEVICE=eth0 BOOTPROTO=static BROADCAST=157.20.0.255 HWADDR=00:0C:29:4D:B9:F2 IPADDR=157.20.0.99 IPV6INIT=yes IPV6_AUTOCONF=yes NETMASK=255.255.255.0 NETWORK=157.20.0.0 ONBOOT=yes

9: How to set Eth Bounding in Linux in Load Balancing Mode?


Crate a bond file: # vi /etc/sysconfig/network-scripts/ifcfg-bond0 DEVICE=bond0 IPADDR=157.20.0.161 NETMASK=255.255.255.0 ONBOOT=yes BONDING_OPTS="mode=0 miimom=100"

Note: In the above configuration we have chosen Bonding Options mode=0 i.e RoundRobin and miimon=100 (Polling intervals 100 ms).
Edit the ETH0 & ETH1 File # vi /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 TYPE=Ethernet USERCTL=no ONBOOT=yes MASTER=bond0 SLAVE=yes BOOTPROTO=none # vi /etc/sysconfig/network-scripts/ifcfg-eth1 DEVICE=eth0 TYPE=Ethernet USERCTL=no ONBOOT=yes MASTER=bond0 SLAVE=yes BOOTPROTO=none # service network restart # watch -n .1 cat /proc/net/bonding/bond0 End of activity

10: How to set a permanent route in Linux ? Simple Command:


echo "1.1.1.0/24 via 157.20.0.161" >> /etc/sysconfig/network-scripts/route-eth1
Note Add appropreate route with the right Eth port

Вам также может понравиться