Home arrow Linux Tips arrow Linux Quick Tips
Linux Quick Tips  
Digg Reddit Ma.gnolia Stumble Upon Facebook Twitter Google Yahoo! MyWeb Furl" BlinkList Technorati Mixx Bookmark

This section offers quick (simple) tips to different Linux Administration Tasks. Sometimes you have to use other distro than you are U usualy do so, you might not know how to do certain tasks in your new Linux distro. Then this tips will help you not to waste time searching how you do that specific task in the distro
you are not familiar with.

1. Add a package in CentOS or list installed packages
------------------------------------------------------------------------
If you want to add rmp packages remotely, on an already installed CentOS Box:
For example you've installed CentOS and you want to install Midnight Commander package.
We will use yum utility to install Midnight Commander:
yum install mc
That's all! Simple, isnt' it?

To list installed packages:
yum list | less

For more informations, man yum


 2. Sort directories by size (Linux, FreeBSD and other UNIXes)
-----------------------------------------------------------------------------------
This tip shows you howto sort subdirectories from a directory by size:

du -s * | sort -rn | head


3. Find if somebody pings you (Linux and FreeBSD)

--------------------------------------------------------------------

tcpdump -i fxp0 'proto \icmp'
(this command is working under FreeBSD, where network interface is fxp0)

tcpdump -i eth0 'proto \icmp'
(this command works under Linux)

4. Extract username from /etc/passwd
----------------------------------------------------
#cat /etc/passwd | cut -f 1 -d ':'
(Content of /etc/paddwd is piped to cut command, using -f parameter for field and -d parameter for delimiter string. This works well under bash on BSD/Linux/UNIX and on FreeBSD's sh shell.)


5. Disable Root SSH Login
-------------------------------
This tip shows you how to disable SSH root login on Linux.

Edit /etc/ssh/sshd_config file:

nano /etc/ssh/sshd_config

and add the following line:

PermitRootLogin no

Then, restart your sshd daemon:

/etc/init.d/sshd restart

 

Polls

What is your favorite Linux Distribution ?