If you want to know the absolute path of a particular executable present in your $PATH, use the 'which' command
which java
/usr/bin/java
Tell init
The current run level of the system can be changed dynamically without the necessity to reboot the system. This can be achieved using the telinit command with the required run level as the command line argument. You can switch into single user mode by running the following command:
telinit S
The administrator could be subsequently return to full multi-user , X- graphical interface mode either by entering
telinit 5
or, if you have made changes to the /etc/inittab file, setting the system to a new default run level that you want, you can do so by using the telinit with the q flag:
telinit q
This actually tells init to re-examine the /etc/inittab file. It is important to note that telinit can only be run as the root and even then, only from the system console.
Hit Ctrl+R to search
The most efficient way to search your shell history is to hit Ctrl+R and start typing the command. It will auto complete your command as soon as there's a match with an entry. Then you can just hit Enter. The following is an example, when I'm searching for the last ls command that I've used.
(reverse-i-search)'ls' : ls -a
Note that pressing Ctrl+, changes the prompt to '(reverse-i-search)'. The following are the two settings that will avoid saving duplicate commands in the history file.
export HISTCONTROL=ignoreboth
export HISTSIZE=500
To make these changes permanent, you can either export the two settings in your bash session (~/.bashrc) or global bash session (/etc/bash.bashrc).
The most efficient way to search your shell history is to hit Ctrl+R and start typing the command. It will auto complete your command as soon as there's a match with an entry. Then you can just hit Enter. The following is an example, when I'm searching for the last ls command that I've used.
(reverse-i-search)'ls' : ls -a
Note that pressing Ctrl+, changes the prompt to '(reverse-i-search)'. The following are the two settings that will avoid saving duplicate commands in the history file.
export HISTCONTROL=ignoreboth
export HISTSIZE=500
To make these changes permanent, you can either export the two settings in your bash session (~/.bashrc) or global bash session (/etc/bash.bashrc).
Stop Beeping at me
Here is an instruction to quickly get rid of the beep sound of the console. To test it, you can simply press Ctrl+G in a shell--if you hear a beep, then it is still on.
To turn it off, in a virtual console (e.g., access one by pressing Ctrl+Alt+F2) you can turn the beep off with the following command:
setterm -blength 0
Alternatively, you can change the frequency of the beep to a very low value:
setterm -breq 20
The maximum limit of the frequency value is 3000.
When working under X11, you turf off the beep with:
xset b off
Here is an instruction to quickly get rid of the beep sound of the console. To test it, you can simply press Ctrl+G in a shell--if you hear a beep, then it is still on.
To turn it off, in a virtual console (e.g., access one by pressing Ctrl+Alt+F2) you can turn the beep off with the following command:
setterm -blength 0
Alternatively, you can change the frequency of the beep to a very low value:
setterm -breq 20
The maximum limit of the frequency value is 3000.
When working under X11, you turf off the beep with:
xset b off
RPM relocation
RPM manages installations, upgrades and uninstalls of packages in Linux systems. It contains the directory structure and installs the same directory structure on the target machine. It contains one nice feature called 'relocate', whichis useful to change the target's directory structure after installation.
The relocate feature can be used in both installation and upgradation. The following is the syntax for the relocate feature:
rpm -i
... where is the file name of the rpm that you want to install, OLDPATH is the existing path, NEWPATH is where you want to relocate it.
For example:
# rpm -ivh tomcat-manual-3.3-m4.2.noarch.rpm --relocate /home/httpd=/var/www
Most of the time the relocate feature is not enabled by default. Under the circumstances, we can use one more feature falled -badreloc, which should be used along with the --relocate feature. The following is he syntax:
# rpm -i
For example:
# rpm -ivh tomcat-manual-3.3-m4.2.noarch.rpm --relocate /home/httpd=/var/www -badreloc
Capture the top output to a file
The top command is a very useful tool to capture information about the process running on Linux. Many a times this information may need to be captured to a file. This can be done with the following command:
top -b -nl > /tmp/top.txt
This will run top once, then write the output to a file and exit. The top command can also be run so that it gives multiple reports. To run top five times and wait five seconds between each output, run the following command:
top -b -n5 -d5 > /tmp/top.txt
For more details on top, refer to its man pages
The top command is a very useful tool to capture information about the process running on Linux. Many a times this information may need to be captured to a file. This can be done with the following command:
top -b -nl > /tmp/top.txt
This will run top once, then write the output to a file and exit. The top command can also be run so that it gives multiple reports. To run top five times and wait five seconds between each output, run the following command:
top -b -n5 -d5 > /tmp/top.txt
For more details on top, refer to its man pages
No comments:
Post a Comment