Linux Tip of the Day - nfs hang fix on hp-ux
In an NFS environment (Hp-UX based), sometimes no user is able to log-in when home directories are mounted using automounter).
As user validation occurs, the user .profile is executed but no shell prompt appears unless the user presses CTRL-C.
The Solution to this is to kill the portmap & inetd and restart the two daemons. The problem will then be sorted out.
Linux Tip of the Day - too many files around
In case there are too many files in a particular directory. When the following is executed:
$grep “ABC” *
And it fails saying with
ksh: /usr/bin/find: 0403-027 The parameter list is too long.
what would you do?
Well you can do the following:
$ls |xargs grep “ABC”
Linux Tip of the Day - look for a string
Sometimes you look for a string in files on your directory using grep, but you end up getting funny characters on your terminal. This is really annoyance, since sometimes you have to reset your terminal if you are using X. What you can do,
you can grep only those files that in text by doing the following command:
grep “hello world” `find ./ -name “*” -print -exec file {} \; |
grep text | cut -d ‘:’ -f 1`
Sure you have to change the “hello World” to the string what you are looking for.
Linux Tip of the Day - use du to find files
Normally:
find . -name *.txt -print
is the command to find a file. But you can locate find more efficiently using du and grep
Use:
du -a |grep *.txt
This will locate all the files with the extension .txt in the current directory.
Linux Tip of the Day - getting more from sigsegv
For those who want to get more info on SIGSEGV for your application in Linux, you can use the following command “catchsegv”.
for eg: consider the program (a.c)
main()
{
char *p = 0;
*p = ‘a’;
}
$cc a.c
$catchsegv a.out #produces the following output
*** Segmentation fault
Register dump:
EAX: 00000000 EBX: 4010e1ec ECX: 08048398 EDX: 4010f098
ESI: 4000ae60 EDI: bffffafc EBP: bffffab0 ESP: bffffaac
EIP: 080483a8 EFLAGS: 00010296
CS: 0023 DS: 002b ES: 002b FS: 0000 GS: 0000 SS: 002b
Linux Tip of the Day - Solaris processor count
Ever needed to know how many processors you have and what speed their running at on your Solaris system?
Just run the command “prtdiag” from the directory /usr/platform/sun4u/sbin. Add a “-v” for even more info about power supply and power/cpu fans.
Linux Tip of the Day - critical print jobs running
If you have critical print queues that must remain enabled at all times, add this script to you crontab.
for i in `lpstat -a | awk ‘{print $1}’`
do
/usr/bin/enable $1
done
Linux Tip of the Day - performance of crond task
A good tip for getting better performance in crond tasks is choosing a better time for launching them.
If the process that we want to launch needs few time, but can overload the system easily, you can launch the task in hours that the work is busy and -and HERE is the tip- in strange minutes. That’s why lots of people launch their crons at midnight, but nobody uses to do it at 00:13, in example.
Linux Tip of the Day - watch those vendors
Need to monitor what a vendor is doing when they access your command line? Don’t have access to programs such as peek? Use
the unix command script.
Into the vendors .profile or .login build a line that states script i.e. script vendorlog, you may place it in a secure directory if you wish by entering the full pathname of the file.
Now when the vendor logs in, the file will show you what commands they entered. If you want to monitor in real time, simply use tail -f to see the characters as they are typed. The vendor will see an output of script started, but it’s your machine, you make the rules regarding access.
Linux Tip of the Day - when did that shell get disconnected
Have you ever come back to work the next day and had your session(s) disconnected, but aren’t sure when it occurred?
I’ve found that logging into a machine with
ssh machinename;date
is pretty useful, as if the machine dies (or the network loses connection overnight), you will immediately know when it happened.
