Sie sind auf Seite 1von 7

Linux Commands: A Introduction

Sunil Kumar
July 23, 2014

Contents
1 The Shell

2 Syntax of Command

3 About Command

4 File and Directory Management

5 Text processing

6 Process management

7 Network or System Management

8 Miscellaneous Commands

The Shell

Shell is command line interpreter, that provides the interface for Linux system. It take input from keyboard as command and transfer to operating
system kernel to carry out. In GUI, KDE uses konsole and GNOME uses
gnome-terminal to interact with the shell.
Shell has two type of shell prompt: $ and #, which represents user level
and root(system administrator) level interaction respectively. User or root
use a set of command on the shell to interact with Linux system.

Syntax of Command

Most commands operate in following manner:


command -options arguments

About Command
type - Display information about command type
Argument: command-name
which - Locate a command
Argument: command-name
help - Display reference page for shell builtin
Useful options: shell in-build command
Argument: command-name
man - Display an on-line command reference
Argument: command-name
info - Display an info document of a command (all about the command)
Argument: command-name
whatis - display manual page descriptions
Argument: command-name
apropos - search the manual page names and descriptions
Argument: command-name
whereis - locate the binary, source, and manual page files for a command
Argument: command-name
alias - Define or display aliases of a command
Useful options: -p
2

Argument: command-name
unalias - Remove each NAME from the list of defined aliases
Useful options: -a
Argument: command-name

File and Directory Management


pwd - Display present working directory
cd - change current working directory
Argument: path of new directory
Special cases
cd : change to users home directory
cd . : change to current directory
cd .. : change to parent directory
cd - : change to previous directory
mkdir - Make directory
Argument: Directory-name
rmdir - Remove an empty directory
Argument: Directory-name
ls - list directory contents
Useful options: -a, -A, -D, -h, -l, -r, -R, -S, -t, -1
Argument: directory-name
cp - copy files and directories
Useful options: -a, -f, -i, -l, -R, -r, -S, -u, -v
Argument: source file/s or directory/s and destination file or directory
rm - remove files or directories
Useful options: -f, -i, -r, -R, -d, -v
3

Argument: file or directory name


mv - move (rename) files
Useful options: -f, -i, -t, -v
Argument: source file/s or directory/s and destination file or directory
touch - change file time-stamps
Useful options: -f, -i, -d, -t, -v
Argument: file-name
file - determine file type
Argument: file-name
more - view the contents of a text file one screen at a time
Comment: Allow only forward navigation but limited backward navigation through the file
Argument: file-name
less - view the contents of a text file one screen at a time
Comment: Allow both forward and backward navigation through the
file
Argument: file-name
chmod - change file mode bits
Comment: Each MODE is of the form
[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=][0-7]+.
Argument: file-name
chgrp - change group ownership
Argument: group-name and file-name
chown - change file owner and group
Argument: owner and file-name
link or ln - make links between files
4

Useful options: -d, -f, -i, -L, -P, -r, -s


Argument: (file-name and link name) or (target file-name with path)
or (directory-name and file-name/s)
unlink - remove the link of the specified file
Argument: file-name
cksum - checksum and count the bytes in a file
Argument: file-name
cmp - compare two files byte by byte
Useful options: -b, -i, -n
Argument: file-name and file-name
diff - compare files line by line
Useful options: -a, -b, -B, -i, -q, -s, -w, -y
Argument: (file-name and file-name) or (directory-name and directoryname)
split - split a file into pieces
Useful options: -a, -b, -C, -l, -n
Argument: file-name

Text processing
cat - concatenate files and print on the standard output
Argument: file-name/s
sort - sort lines of text files
Useful options: -d, -f, -g, -n, -m, -r, -o
Argument: file-name/s
wc - print newline, word, and byte counts for each file
Useful options: -c, -l, -m, -w
Argument: file-name]
5

uniq - report or omit repeated lines


Useful options: -c, -d, -u
Argument: file-name]
tee - read from standard input and write to standard output and files
Useful options: -a
Argument: file-name

Process management
ps - report a snapshot of the current processes
Useful options: -A, T, r, -p, -u
Argument: optional process-name or -id
top - display Linux processes in a dynamic real-time view
Useful options: -d, -H, -p, -u
bg - Move jobs to the background
Argument: job-name
fg - Move job to the foreground.
Argument: job-name
kill - terminate a process
Useful options: -n (n=1-9)
Argument: pid (process-id)

Network or System Management


passwd - update users authentication tokens
Useful options: -d, -e, -f, -l, -k, -u, -n, -x, -w, -i, -S
Argument: user-name
who - show who is logged on (user-name)
6

Useful options: -a, -b, -q, -r, -t, -u


uname - print system information
Useful options: -a, -s, -n, -r, -v, -m, -p,-i, -o

Miscellaneous Commands
date - print or set the system date and time
Useful options: -d, -S, -u, date
Environmental variable: TZ (time zone)
cal - display a calendar
Useful options: -1, -3, -s, -m , -y

Das könnte Ihnen auch gefallen