Essential Linux System Administration – Tips-4

1

Q. How can I talk to user on my Linux box?

A. At your Linux prompt

Who

Write

+d

Q. How can I talk to all the users at once on my Linux box?

A. At your Linux prompt

Wall

+d

Q. How can I count the lines in a file?

A. At your Linux prompt

wc    -l

Q. How can I divide a number?

A. At your Linux prompt

echo    “1234567 /2”  |   bc

Q. How can I stop a crontab from emailing me?

A. Just add this to the  end of the crontab line

>     /dev/null     2>&1

For example:

#Run my _script every 5 minutes

*/5   * * * *     /usr/local/bin/my_script     >   /dev/null     2>&1

Q. How can I have the results of a contrab be emailed to a user?

A. Just use mailx

Syntax:  [command or script]  |  mailx    –s    “subject line”    [EMAIL]

For example:

#Run date_script every 20 minutes

*/20   * * * *    /bin/date_script     |     mailx      –s      “Date script cron”     root

Q. How can I list files by size?

A. At your Linux prompt type

ls   -l    |    sort     –n      +4

Q. How do remove blank lines from a file?

A.Just use sed

sed     –e    ‘/^ $ /d’

 

———————- Thanks

Share.

About Author

TN365

1 Comment

Leave A Reply

CAPTCHA ImageChange Image