Some useful linux commands

at –at executes commands at a specified time

banner — print banner to standard output

bash — Bourne again shell. This is the default shell in the Red Hat installation

bzip2 –compresses files using the Burrows-Wheeler block sorting text compression algorithm, and Huffman coding

cal — displays a simple calendar. If arguments are not specified, the current month is displayed

cat – concatenate files and print on the standard output

e.g. cat test.txt display the content of test.txt file

cd – change working directory

chgrp – change group ownership associated with files and directory

e.g. chgrp group files where group is group name.

chkconfig – updates and queries runlevel information for system services

e.g. chkconfig sendmail off

chmod – set permissions of files or directories

e.g. chmod 755 test.txt

chown — changes ownership of a file

e.g. chown admin test.txt

chsh — change default shell

cp – copy files and directories

cpio – copy files to and from archives

cpp – GNU C-compatible compiler preprocessor

crontab – schedules script to run at regularly on specified time.

date – displays or sets date and time

dd – direct copy of file from one device to another. Can be used to make copies of boot or root diskettes for installing Linux

df — displays capacity and free capacity on different physical devices such as hard drive partitions and floppy drives that are mounted on the file system.

diff — displays differences between two files

e.g. diff test1.txt test2.txt

dir – list directory contents.

e.g. dir test will display the content of directory test.

dmesg–dmesg is used to examine or control the kernel ring buffer .

du – displays information on disk usage.

e.g. du -h test, will show the disk occupier by test in human readable form.

echo – write arguments to standard output. Another use is to print out information about environment variables and classpath

echo $PATH – list paths

echo $CLASSPATH -show classpath

env – desplay the current environment or set a variable equal to a new value.

export – set the value of a variable in the system environment

fdisk – use for Partition table manipulator for Linux.

e.g. fdisk -l print the currently mounted partition.

file – displays classification of a file or files according to the type of data they contain

find – find files according to various of search criteria.

e.g. find . -name filename -print

Find files matching a particular name on the working directory and all subdirectories.

finger – display information about a specified userid or userids

free – gives used and free memory on system .

fsck – file system check and repair

grep – used to find a string within a file and files

e.g. grep -i “search” test.txt. looks for pattern search in file test.txt irespective of case.

groupadd – create a new group on the system

groups – shows which groups you are in .

grub – GRand Unified Bootloaderr. Can be used instead of lilo to boot multiple operating systems .

gunzip – used to uncompress files compressed with gzip

gzip – used to compress or expand files

halt – shut down system as root, without reboot, immediately

head – Display the first part of files

history – command for viewing and manipulating the shell command history list

history -c ,clear the history of the command run on the system

hostname – used to get or set hostname. Typically, the host name is stored in the file /etc/host

ifconfig – configure a network interface

ifconfig -a display both the configured and non configured interfaces.

ifdown – shut down the particular network interface

e.g. ifdown eth0

ifup — start up the particularinterface

ifup eth0

info – display system information. This is the GNU hypertext reader

init – the power house of all processes, run at bootup, executes commands in /etc/inittab. Can be used with root privileges to change the system run level .

insmod — used (by root) to install modular device drivers.

jobs – displays list of currently running and halted jobs in the background

we can use bg and fg command to brieng and send a job from back ground to fore ground and vice versa.

kill – sends a signal to terminate a job or process

The command kill sends the specified signal to the specified process or process group. If no signal is specified, the TERM signal is
sent. The TERM signal will kill processes which do not catch this signal. For other processes, it may be necessary to use the KILL
(9) signal, since this signal cannot be caught

killall – kill processes by name

e.g. killall java will kill are the running process of java.

last — show listing of last logged in users.

ldconfig – creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file /etc/, and in the trusted directories (/usr/lib and /lib). Ldconfig checks the header and file names of the libraries it encounters when determining which versions should have their links updated. Ldconfig ignores symbolic links when scanning for libraries .

ldd – list the shared libraries on which a given executable depends, and where they are located .

locate – find files by name

e.g. locate test.txt

Source — linux man pages and internet.