Basic Linux Commands and Utilities

May 1, 2008 Linux Configuration | Comments (0) admin @ 10:58 pm

Linux CommandLinux Command

This is som of linux command you should to know when you start to use the linux operating system. It is the basic for start to learning linux and it have more and hard command when you learn thoroughly on linux.

Command

 

Usage For

 

man Get help.
cd Move to a different directory.
pwd Print working directory.
find Search directories for matching files.
whereis Find files from files directories.
locate Locate files from locate’s database - locatedb.
updatedb Update locatedb database.
whatis Get command summaries.
makewhatis Build the whatis database (db of command summaries).
apropos Search for whatis database to get the program you want.
ls List files and directories.
dir List directories.
tree List graphic directory.
cat List, create, and combine files.
more Read files.
less Read files (allows scrolling, have more options than the more command).
head,tail Read the beginning and the end of files.
touce Create files.
rm Delete files.
mkdir Create directories.
rmdir Removing directories.
mv Rename files.
cp Copy files.
ln Create hard and symbolic links.
mc Visual shell that display files.
grep, egrep, fgrep, zgrep Search inside files (zgrep can search compressed files).
tar Create archives file.
cpio Copy files in and out of tar or cpio archives.
gzip, gunzip Compress and uncompress files.
compress Compress files.
ps Process status command.
kill Terminate a process.
Ctrl-z Put a running program into background in bash shell.
fg Bring back a program from background.
pine A Linux mail program.
job Get a list of suspended programs.
sc A Linux spreadsheet program.
mount, umount Mount or unmount a file system.
You can use man command for using each other
command, example for using man command : man ps [press enter]
>>> For help, how you can use ps command.

Automated Tasks On Linux (At and Batch)

Linux Configuration | Comments (0) admin @ 9:18 am

2. At and BatchLinux AT Command

While cron is used to schedule recurring tasks, the at command is used to schedule a one-time task at a specific time and the batch command is used to schedule a one-time task to be executed when the systems load average drops below 0.8. To use at or batch, the at RPM package must be installed, and the atd service must be running. To determine if the package is installed, use the rpm -q at command. To determine if the service is running, use the command /sbin/service atd status.

2.1. Configuring At Jobs

To schedule a one-time job at a specific time, type the command at time, where time is the time to execute the command.

The argument time can be one of the following:

- HH:MM format — For example, 04:00 specifies 4:00 a.m. If the time is already past, it is executed at the specified time the next day.

- midnight — Specifies 12:00 a.m.

- noon — Specifies 12:00 p.m.

- teatime — Specifies 4:00 p.m.

- month-name day year format — For example, January 15 2002 specifies the 15th day of January in the year 2002. The year is optional.

- MMDDYY, MM/DD/YY, or MM.DD.YY formats — For example, 011502 for the 15th day of January in the year 2002.

- now + time — time is in minutes, hours, days, or weeks. For example, now + 5 days specifies that the command should be executed at the same time five days from now.

The time must be specified first, followed by the optional date. For more information about the time format, read the /usr/share/doc/at-<version>/timespec text file.

Read More…

Automated Tasks On Linux (Cron)

Linux Configuration | Comments (0) admin @ 9:10 am

Linux Cron TabsLinux Cron Tabs

In Linux, tasks can be configured to run automatically within a specified period of time, on a specified date, or when the system load average is below a specified number. Red Hat Enterprise Linux is pre-configured to run important system tasks to keep the system updated. For example, the slocate database used by the locate command is updated daily. A system administrator can use automated tasks to perform periodic backups, monitor the system, run custom scripts, and more.

Red Hat Enterprise Linux comes with several automated tasks utilities: cron, at, and batch.

1. Cron

Cron is a daemon that can be used to schedule the execution of recurring tasks according to a combination of the time, day of the month, month, day of the week, and week.
Cron assumes that the system is on continuously. If the system is not on when a task is scheduled, it is not executed. To schedule one-time tasks, refer to At and Batch.

To use the cron service, the vixie-cron RPM package must be installed and the crond service must be running. To determine if the package is installed, use the rpm -q vixie-cron command. To determine if the service is running, use the command /sbin/service crond status.

1.1. Configuring Cron Tasks

The main configuration file for cron, /etc/crontab, contains the following lines:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

Read More…