About Linux
Linux Kernel was developed by Linus Benedict Torvalds at University of Helsinki in Finland. It was in 1991, he was a student there. The effort expanded with volunteers contributing code and documentation over the internet. Now the GNU (GNU's Not Unix) utilities and Linux Kernel combined to form the complete Linux Operating System.
Linux Features Include:
1. Virtual memory, RAM enhanced with the SWAP partition.
2. Networking with TCP/IP and other protocols.
3. Effective Multitasking.
4. Multiple user capability.
5. Shared libraries.
6. Programs or Users can't access unauthorized areas.
7. Both Graphical and Virtual Consoles.
8. Advanced server functionality.
· FTP server
· Telnet server
· BOOTP server
· DHCP server
· Samba server
· DNS server
· Apache Server
· SNMP services
· Mail services
· NFS Server
· NIS & more...
9. Support of filesystems that other operating systems use such as DOS (FAT), Windows95,98 (FAT32), Windows NT, 2000 (NTFS), Apple, minix, and others.
Reasons to promote Linux :
1. Open Source.
2. Support various machine architectures.
3. Linux is much friendly with our old low configuration computers !!! Recommended 8MB RAM, with 16MB swap drive space. It will run in hard drives as small as 500MB or less.
4. Linux is stable and even if a program crashes, it won't bring the whole Operating System down.
Linux Logging in, Logging Out & Shutting down :
Logging in
When booted your Linux System, you should see a login prompt on your monitor. When you did your Linux install you should have set a root password. You may have also created a user with a password. Therefore to log in, you need to type your username or "root" as your username and enter the appropriate password. If you logged in as a normal user and know the root password and want to use administration commands, you may use the command "su" to become a "super user".
[shibipnr@fedora ~]$ su – root
The above command will ask for your root password, by providing the same you would be able to have the complete administrative privileges on your computer. Some systems also support the "sudo" command, which allows administrative privileges on a command by command basis.
Logging out
Use the command "logout" to exit a given session. The "exit" command will take you back to previous shell levels.
Shutting Linux Down
The system is intended to be shutdown by the system administrator using the shutdown command in one of the forms shown below.
Command will shutdown and halt the system immediately.
[root@fedora ~]# shutdown -h now
Command to reboot the system in 10 minutes and to send the message to all users.
[root@fedora ~]# shutdown -r +10 "Rebooting in 10 minutes"
Command to shut the system down and to do a reboot at 1:00 PM.
[root@fedora ~]# shutdown -r 13:00
Important Linux Commands
Most of the Important Linux commands and options are listed below. Associated Manual pages are also linked with respective commands. All of these commands should work from your command prompt (regardless which shell you’re using). All Linux commands are case sensitive.
You can also execute multiple commands by separating each one with a ; for example cd newdir; mkdir thatdir ; ls -la will first change directories to the newdir directory, then create a directory called thatdir, then list all the files in long format.
access – determine whether a file can be accessed
Syntax
access -mode file
alias – define or display aliases
Syntax
alias [alias-name[=string] …]
bg – run jobs in the background
Syntax
bg [job_id ...]
cal – displays a calendar
Syntax
cal [-smjy13 ] [[ month ] year ]
cd – change directories
Use cd to change directories. Type cd followed by the name of a directory to access that directory.Keep in mind that you are always in a directory and can navigate to directories hierarchically above or below.
Syntax
cd [-L | -P] [directory]
chown – change file owner and group
Syntax
chown [OPTION] OWNER[:[GROUP]] FILE
chown [OPTION] :GROUP FILE
chown [OPTION] –reference=RFILE FILE
chmod – change file access permissions
Syntax
chmod [-r] permissions filenames
Options
r Change the permission on files that are in the subdirectories of the directory that you are currently in. permission Specifies the rights that are being granted. Below is the different rights that you can grant in an alpha numeric format.filenames File or directory that you are associating the rights with Permissions
u – User who owns the file.
g – Group that owns the file.
o – Other.
a – All.
r – Read the file.
w – Write or edit the file.
x – Execute or run the file as a program.
Numeric Permissions:
CHMOD can also to attributed by using Numeric Permissions:
400 read by owner
040 read by group
004 read by anybody (other)
200 write by owner
020 write by group
002 write by anybody
100 execute by owner
010 execute by group
001 execute by anybody
cp – Copy files and directories
Syntax
cp [OPTION]… SOURCE DEST
cp [OPTION]… SOURCE… DIRECTORY
cp [OPTION]… –target-directory=DIRECTORY SOURCE…
cp [OPTION]… SOURCE… DIRECTORY
cp [OPTION]… –target-directory=DIRECTORY SOURCE…
Options
cp myfile yourfile
Copy the files “myfile” to the file “yourfile” in the current working directory. This command will create the file “yourfile” if it doesn’t exist. It will normally overwrite it without warning if it exists.
cp -i myfile yourfile
With the “-i” option, if the file “yourfile” exists, you will be prompted before it is overwritten.
cp -i /data/myfile
Copy the file “/data/myfile” to the current working directory and name it “myfile”. Prompt before overwriting the file.
cp -dpr srcdir destdir
Copy all files from the directory “srcdir” to the directory “destdir” preserving links (-poption), file attributes (-p option), and copy recursively (-r option). With these options, a directory and all it contents can be copied to another dir
clear – Clears the terminal screen.
Syntax
clear
cmp – Compares two files, reporting all discrepancies. Similar to the diff command, though the output format differs.
Syntax
cmp [-clsv] [-i NUM] [--help] [--print-chars] [--ignore-initial=NUM] [--verbose] [--quiet] [--silent] [--version] -I FILE1 [FILE2 [RANGE1 [RANGE2]]]
cat - Sends file contents to standard output. This is a way to list the contents of short files to the screen. It works well with piping.
Syntax
cat [OPTION] [FILE]…
diff – find differences between two files
Syntax
diff [options] from-file to-file
dmesg – Prints the messages resulting from the most recent system boot.
Syntax
dmesg [ -c ] [ -n level ] [ -s bufsize ]
du – estimate file space usage
Syntax
du [OPTION]… [FILE]…
Syntax
df [OPTION]… [FILE]…
exit - cause the shell to exit
syntax
exit [n]
eject – eject removable media
Syntax
eject -h
eject [-vnrsfqp] []
eject [-vn] -d
eject [-vn] -a on|off|1|0 []
eject [-vn] -c slot []
eject [-vn] -t []
eject [-vn] -x []
eject -V
eject [-vnrsfqp] []
eject [-vn] -d
eject [-vn] -a on|off|1|0 []
eject [-vn] -c slot []
eject [-vn] -t []
eject [-vn] -x []
eject -V
fuser – identify processes using files or sockets
Syntax
fuser [-a|-s|-c] [-4|-6] [-n space] [-k [-i] [-signal] ] [-muvf] name
fuser -l
fuser -V
fuser -l
fuser -V
fsck – check and repair a Linux file system
Syntax
fsck [ -sACVRTNP ] [ -t fstype ] filesys [ ... ] [--] [ fsck-options ]
fdisk – Partition table manipulator for Linux
Syntax
fdisk [-u] [-b sectorsize] [-C cyls] [-H heads] [-S sects] device
fdisk -l [-u] device …
fdisk -s partition …
fdisk -v
fdisk -l [-u] device …
fdisk -s partition …
fdisk -v
fg – run jobs in the foreground
Syntax
fg [job_id]
file – determine file type
Syntax
file [ -bciknsvzL ] [ -f namefile ] [ -m magicfiles ] file …
file -C [ -m magicfile ]
file -C [ -m magicfile ]
find – search for files in a directory hierarchy
Syntax
find [path...] [expression]
finger – Prints descriptions of the specified users.
Syntax
finger [-lmsp ] [user ... ] [user@host ... ]
Syntax
free [-b | -k | -m] [-o] [-s delay ] [-t] [-V]
ftp – A File Transfer Protocol client
Syntax
ftp hostname or ipaddress
grep, egrep, fgrep – print lines matching a pattern
Syntax
grep [options] PATTERN [FILE...]
grep [options] [-e PATTERN | -f FILE] [FILE...]
grep [options] [-e PATTERN | -f FILE] [FILE...]
head – output the first part of files
Syntax
head [OPTION]… [FILE]…
history – Manipulate the history list
Syntax
history option arg arg …
!!
use the ! option. To automatically re-display the last command you typed at the prompt, type: !! and press enter. Press again to invoke the command. You can also automatically re-display a command you typed earlier by using the ! and the first few letters of the command.
& operator
execute a command as a background process.
Ex:-
#top&
Syntax
/sbin/init [ -a ] [ -s ] [ -b ] [ -z xxx ] [ 0123456Ss ]
ispell - ispell, buildhash, munchlist, findaffix, tryaffix, icombine, ijoin – Interactive spelling checking
Syntax
ispell [common-flags] [-M|-N] [-Lcontext] [-V] files
ispell [common-flags] -l
ispell [common-flags] [-f file] [-s] {-a|-A}
ispell [-d file] [-w chars] -c
ispell [-d file] [-w chars] -e[e]
ispell [-d file] -D
ispell -v[v]
ispell [common-flags] -l
ispell [common-flags] [-f file] [-s] {-a|-A}
ispell [-d file] [-w chars] -c
ispell [-d file] [-w chars] -e[e]
ispell [-d file] -D
ispell -v[v]
id - Print real and effective user id (uid) and group id (gid), prints options about the given user, or if no user is specified the process running it
Syntax
id [options]… [username]
kill – terminate a process
Syntax
kill [ -s signal | -p ] [ -a ] [ -- ] pid … kill -l [ signal ]
killall – kill processes by name
Syntax
killall [-Z,--context pattern] [-e,--exact] [-g,--process-group] [-i,--interactive] [-q,--quiet] [-r,--regexp] [-s,--signal signal] [-u,--user user] [-v,--verbose] [-w,--wait] [-I,--ignore-case] [-V,--version] [--] name … killall -l killall -V,–version
logname – Print current login name
Syntax
logname [OPTION]
less – Opposite of the more command
Syntax
less -?
less –help
less -V
less –version
less [-[+]aBcCdeEfFgGiIJmMnNqQrRsSuUVwWX]
[-b space] [-h lines] [-j line] [-k keyfile]
[-{oO} logfile] [-p pattern] [-P prompt] [-t tag]
[-T tagsfile] [-x tab,...] [-y lines] [-[z] lines]
[+[+]cmd] [--] [filename]…
less –help
less -V
less –version
less [-[+]aBcCdeEfFgGiIJmMnNqQrRsSuUVwWX]
[-b space] [-h lines] [-j line] [-k keyfile]
[-{oO} logfile] [-p pattern] [-P prompt] [-t tag]
[-T tagsfile] [-x tab,...] [-y lines] [-[z] lines]
[+[+]cmd] [--] [filename]…
logout – to quit using the system
Syntax
logout
lsof - list open files
Syntax
lsof [ -?abChlnNOPRstUvVX ] [ -A A ] [ -c c ] [ +c c ] [ +|-d d ] [ +|-D D ] [ +|-f [cfgGn] ] [ -F [f] ] [ -g [s] ] [ -i [i] ] [ -k k ] [ +|-L [l] ] [ +|-m m ] [ +|-M ] [ -o [o] ] [ -p s ] [ +|-r [t] ] [ -S [t] ] [ -T [t] ] [ -u s ] [ +|-w ] [ -x [fl] ] [ -z [z] ] [ -- ] [names]
ls – Short listing of directory contents
Syntax
ls [OPTION]… [FILE]…
Options
-a list hidden files
-d list the name of the current directory
-F show directories with a trailing ‘/’
executable files with a trailing ‘*’
-g show group ownership of file in long listing
-i print the inode number of each file
-l long listing giving details about files and directories
-R list all subdirectories encountered
-t sort by time modified instead of name
ln – make links between files
Syntax
ln [OPTION]… TARGET [LINK_NAME]
ln [OPTION]… TARGET… DIRECTORY
ln [OPTION]… –target-directory=DIRECTORY TARGET…
ln [OPTION]… TARGET… DIRECTORY
ln [OPTION]… –target-directory=DIRECTORY TARGET…
Option
ln -s test symlink
Creates a symbolic link named symlink that points to the file test Typing “ls -i test symlink” will show the two files are different with different inodes. Typing “ls -l test symlink” will show that symlink points to the file test.
locate – list files in databases that match a pattern
Syntax
locate [-d path | --database=path] [-e | --existing] [-i | --ignore-case ] [--version] [--help] pattern…
Syntax
mail [OPTION...] [address...]
Syntax
man [-c|-w|-tZHT device] [-adhu7V] [-m system[,...]] [-L locale] [-p string] [-M path] [-P pager] [-r prompt] [-S list] [-e extension] [[section] page …] …
man -l [-7] [-tZHT device] [-p string] [-P pager] [-r prompt] file …
man -k [apropos options] regexp …
man -f [whatis options] page …
man -l [-7] [-tZHT device] [-p string] [-P pager] [-r prompt] file …
man -k [apropos options] regexp …
man -f [whatis options] page …
mkdir – make directories
Syntax
mkdir [OPTION] DIRECTORY
Options
Create the Directory(ies), if they do not already exist.
Mandatory arguments to long options are mandatory for short options too.
-m, mode=MODE set permission mode (as in chmod)
-p, parents no error if existing, make parent directories as needed
-v, verbose print a message for each created directory
-help display this help and exit
-version output version options and exit
mount – mount a file system
Syntax
mount [-lhV]
mount -a [-fFnrsvw] [-t vfstype] [-O optlist]
mount [-fnrsvw] [-o options [,...]] device | dir
mount [-fnrsvw] [-t vfstype] [-o options] device dir
mount -a [-fFnrsvw] [-t vfstype] [-O optlist]
mount [-fnrsvw] [-o options [,...]] device | dir
mount [-fnrsvw] [-t vfstype] [-o options] device dir
mv – change the name of a directory
Type mv followed by the current name of a directory and the new name of the directory
Syntax
Syntax
mv [OPTION]… [-T] SOURCE DEST mv [OPTION]… SOURCE… DIRECTORY mv [OPTION]… -t DIRECTORY SOURCE…
Ex: mv testdir newnamedir
more – Allows file contents or piped output to be sent to the screen one page at a time.
Syntax
more [-dlfpcsu ] [-num ] [+/ pattern] [+ linenum] [file ... ]
nohup – run a command immune to hangups, with output to a non-tty
Syntax
nohup COMMAND [ARG]…
nohup OPTION
nohup OPTION
nice – run a program with modified scheduling priority
Syntax
nice [OPTION] [COMMAND [ARG]…]
ping – send ICMP ECHO_REQUEST packets to network hosts
Syntax
ping [-Rdfnqrv ] [-c count ] [-i wait ] [-l preload ] [-p pattern ] [-s packetsize ] host
ps – report process status
Syntax
ps [options]
pwd – print working directory
will show you the full path to the directory you are currently in. This is very handy to use, especially when performing some of the other commands on this page.
Syntax
pwd [OPTION]
passwd – change user password
Syntax
passwd [-f|-s] [name]
passwd [-g] [-r|R] group
passwd [-x max] [-n min] [-w warn] [-i inact] name
passwd {-l|-u|-d|-S|-e} name
passwd [-g] [-r|R] group
passwd [-x max] [-n min] [-w warn] [-i inact] name
passwd {-l|-u|-d|-S|-e} name
reboot – Reboots the system (requires root privileges).
Syntax
/sbin/halt [-n] [-w] [-d] [-f] [-i] [-p] [-h] /sbin/reboot [-n] [-w] [-d] [-f] [-i] /sbin/poweroff [-n] [-w] [-d] [-f] [-i] [-h]
rmdir – remove empty directories
Syntax
rmdir [OPTION]… DIRECTORY…
rm – remove files or directories
Syntax
rm [OPTION]… FILE…
Option
rm -r – Removes directories and files within the directories recursively.
renice – alter priority of running processes
Syntax
renice priority [[-p ] pid … ] [[-g ] pgrp … ] [[-u ] user … ]
shutdown – bring the system down
Syntax
/sbin/shutdown [-t sec] [-arkhncfF] time [warning-message]
sleep – delay for a specified amount of time
Syntax
sleep NUMBER[SUFFIX]…
sleep OPTION
sleep OPTION
sort – sort lines of text files
Syntax
sort [OPTION]… [FILE]…
split – split a file into pieces
Syntax
split [OPTION] [INPUT [PREFIX]]
Syntax
slocate [-qi] [-d] [--database= ]
slocate [-i] [-r ] [--regexp=]
slocate [-qv] [-o ] [--output=] slocate [-e ] [-f ] <[-l ] [-c] <[-U ] [-u]>
slocate [-Vh] [--version] [--help]
slocate [-i] [-r ] [--regexp=]
slocate [-qv] [-o ] [--output=] slocate [-e ] [-f ] <[-l ] [-c] <[-U ] [-u]>
slocate [-Vh] [--version] [--help]
su – run a shell with substitute user and group IDs
Syntax
su [OPTION]… [-] [USER [ARG]…]
telnet – user interface to the TELNET protocol
Syntax
telnet [-8] [-E] [-F] [-K] [-L] [-S tos] [-X authtype] [-a] [-c] [-d] [-e escapechar] [-f] [-k realm] [-l user] [-n tracefile] [-r] [-x] [host [port]]
top – display top CPU processes
Syntax
top [-] [d delay] [p pid] [q] [c] [C] [S] [s] [i] [n iter] [b]
talk – talk to another user
Syntax
talk person [ttyname]
tree - list contents of directories in a tree-like format.
Syntax
tree [-adfgilnopqrstuxACDFNS] [-L level [-R]] [-H baseHREF] [-T title] [-o filename] [--nolinks] [-P pattern] [-I pattern] [--inodes] [--device] [--noreport] [--dirsfirst] [--version] [--help] [directory ...]
tr – translate or delete characters
Syntax
tr [OPTION]… SET1 [SET2]
time – time a simple command or give resource usage
Syntax
time [options] command [arguments...]
tty – print the file name of the terminal connected to standard input
Syntax
tty [OPTION]…
touch – change file timestamps
Syntax
touch [OPTION]… FILE…
tail – output the last part of files
Syntax
tail [OPTION]… [FILE]…
traceroute – print route packets take to network host
Syntax
traceroute [-adnruvAMOQ] [-w wait_time] [-S start_ttl] [-m max_ttl] [-p port] [-q nqueries] [-g gateway] [-t tos] [-s src_addr] [-g router] host [packet size]
uptime – Tell how long the system has been running.
Syntax
uptime
uptime [-V]
uptime [-V]
umount – unmount file systems
Syntax
umount [-hV]
umount -a [-dflnrv] [-t vfstype] [-O options]
umount [-dflnrv] dir | device [...]
umount -a [-dflnrv] [-t vfstype] [-O options]
umount [-dflnrv] dir | device [...]
umask – get or set the file mode creation mask
Syntax
umask [-S][mask]
ulimit – Control the resources available to a process started by the shell, on systems that allow such control.
Syntax
ulimit [-acdfHlmnpsStuv] [limit]
uname – print system options
Syntax
uname [OPTION]…
uniq – report or omit repeated lines
Syntax
uniq [OPTION]… [INPUT [OUTPUT]]
vdir – list directory contents
Syntax
vdir [OPTION]… [FILE]…
w – Show who is logged on and what they are doing.
Syntax
w – [husfV] [user]
wall – send a message to everybody’s terminal.
Syntax
wall [-n] [ message ]
who – show who is logged on
Syntax
who [OPTION]… [ FILE | ARG1 ARG2 ]
whoami – print effective userid
Syntax
whoami [OPTION]…
watch – execute a program periodically, showing output fullscreen
Syntax
watch [-dhv] [-n ] [--differences[=cumulative]] [--help] [--interval=] [--version]
whereis – locate the binary, source, and manual page files for a command
Syntax
whereis [ -bmsu ] [ -BMS directory... -f ] filename …
wc – print the number of newlines, words, and bytes in files
Syntax
wc [OPTION]… [FILE]…
xload – system load average display for X
Syntax
xload [-toolkitoption ...] [-scale integer] [-update seconds] [-hl color] [-highlight color] [-remote host] [-jumpscroll pixels] [-label string] [-nolabel] [-lights]