2. Background of Linux
Version of UNIX
Linus Torvalds – Creator of Linux
Open Source Operating System
Free Software
Source Code Available
3. Where is Linux used?
→ 75% of respondents were already using Linux and another
14% were evaluating it
→ 43% of all web sites use Linux servers running the Apache
Web server
4. How Linux is used?
Personal Workstation
File and Print Server
Internet Service Provider
Three-tier Client/Server
About Kernel:
Linux kernel for free
Kernel is central component
Kernel can be customized to user’s needs
5. Unix Commands
A command is a program which interacts with the kernel to
provide the environment and perform the functions called for
by the user.
A command can be: a built-in shell command; an executable
shell file, known as a shell script; or a source compiled, object
code file.
The shell is a command line interpreter. The user interacts
with the kernel through the shell. You can write ASCII (text)
scripts to be acted upon by a shell.
6. Taking Help
The man command displays reference pages for the
command you specify.
The UNIX man pages (man is short for manual ) cover every
command available.
To search for a man page, enter man followed by the name of the
command to find .
For example:
% man cp
Or try:
% man man
8. ls
List directory contents
Has whole bunch of options.
•% ls
all files except those starting with a
“.”
•% ls -a
all
•% ls -A
all without “.” and “..”
• % ls -F
append “/” to dirs and “*” to
executables
• % ls -l
long format
• % ls -al
• % ls -lt
sort by modification time (latest -
earliest)
• % ls -ltr
reverse
9. cp
Copies files / directories.
% cp [options] <source> <destination>
% cp file1 file2
% cp file1 [file2] … /directory
Useful option: -i to prevent overwriting existing files and
prompt the user to confirm.
13. cd
Changes your current directory to a new one.
% cd /some/other/dir
Absolute path
% cd subdir
Assuming subdir is in the current directory.
% cd
Returns you to your home directory.
17. chmod
Changes file permissions
Possible invocations
% chmod 600 filename
-rw------- 1 user group 2785 Feb 8 14:18 filename
(a bit not intuitive where 600 comes from)
(owner) (group) (others)
chmod [number][number][number] file1
Number = (read)4 + (write)2 + (execute)1
Example: Chmod 754 file1
for owner: read, write and execute permissions (4+2+1)
for group: read and execute permissions (4+0+1)
for others: only read permission (4+0+0)
18. chmod
Some of the things these commands manipulate:
The time stamp: Each file has three dates associated with it. These are creation
time, last modification time and last access time.
The owner: the owner of files
The group: the group of users
The permissions: read, write, execute permissions of files. The permissions tell
unix who can access what file, or change it, or, in the case of programs, execute
it. Each of these permissions can be toggled separately for the owner, the group,
and all the other users.
19. chmod
drwxr-xr-x 2 dag users 6 Dec 6 2000 netscape
owner
group
others
file name
read, write, execute
permissions of files
20. grep
Searches its input for a pattern.
The pattern can be a simple substring or a complex
regular expression.
If a line matches, it’s directed to STDOUT; otherwise,
it’s discarded.
% echo “blah-foo” | grep blah
Will print the matching line
% echo “blah-foo” | grep zee
Will not.
21. alias
Defined a new name for a command
% alias
with no arguments lists currently active aliases
% alias newcommand oldcommand
defines a newcommand
22. ssh
ssh (SSH client) is a program for logging into a
remote machine and for executing commands on a remote
machine.
It provide secure encrypted communications between two
untrusted hosts over an insecure network.
ssh -i /home/narendra/.ssh/keir_wp.pem -o
IdentitiesOnly=yes ubuntu@52.19.236.56 -v
23. scp
Scp (Secure Copy) is a command line tool to copy or
transfer files across hosts.
It uses the same kind of security mechanism like the
ssh program.
It uses an ssh connection in the background to perform
the file transfer.
Scp <source> <destination>
Copy the file "foobar.txt" from a remote host to the
local host
scp your_username@remotehost.edu:foobar.txt
/some/local/directory
Copy the file "foobar.txt" from remote host "rh1.edu"
to remote host "rh2.edu"