An Introduction To: Linux
An Introduction To: Linux
&
Contents
A quick guide to Linux
Background Using Linux
Additional Resources
What is Linux
A fully-networked 32/64-Bit Unix-like Operating System
Unix Tools Like sed, awk, and grep (explained later)
Linux 1.0 in 1994; 2.2 in 1999 Today used on 7-10 million computers
with 1000s of programmers working to enhance it
Why is it significant?
Growing popularity Powerful
Runs on multiple hardware platforms Users like its speed and stability No requirement for latest hardware
Its free
Licensed under GPL Vendors are distributors who package Linux
Linux/390
Using it
Logging In
Connect to the Linux system using telnet:
vt100, vt220, vt320 ansi tty X-windows
Logging In
Before you can use it you must login by specifying your account and password:
Linux 2.2.13 (penguinvm.princeton.edu) (ttyp1)
penguinvm login: neale Password: Last login: Tue Jan 4 10:13:13 from linuxtcp.princeton.edu [neale@penguinvm neale]$
Rule Number 1
Do not login as root unless you have to root is the system superuser (the maint of Linux but more dangerous)
Normal protection mechanisms can be overridden Careless use can cause damage Has access to everything by default
[root@penguinvm]# passwd scully Changing password for user scully New UNIX password: Retype new UNIX password: passwd: all authentication tokens updated successfully [root@penguinvm]#
The shell interprets user commands. It is responsible for finding the commands and starting their execution. Several different shells are available. Bash is popular,
The kernel manages the hardware resources for the rest of the system.
Hardware
Naming Files
Files are named by
naming each containing directory starting at the root
pathname
/etc/passwd
/home/neale/b
if you omit the leading / then path name is relative to the current working directory Use pwd to find out where you are
Current working directory
doc/letter ./doc/letter /home/neale/doc/letter
Examples:
./a same as a ../jane/x go up one level then look in directory jane for x
Special Files
/home - all users home directories are stored here /bin, /usr/bin - system commands /sbin, /usr/sbin - commands used by sysadmins /etc - all sorts of configuration files /var - logs, spool directories etc. /dev - device files /proc - special system files
Redirecting Output
The output of a command may be sent (piped) to a file:
ls -l >output
> is used to specify the output file
Redirecting Input
The input of a command may come (be piped) from a file:
wc <input
< is used to specify the input file
Common Commands
pwd - print (display) the working directory cd <dir> - change the current working directory to dir ls - list the files in the current working directory ls -l - list the files in the current working directory in long format
File Commands
cp <fromfile> <tofile>
Copy from the <fromfile> to the <tofile>
mv <fromfile> <tofile>
Move/rename the <fromfile> to the <tofile>
rm <file>
Remove the file named <file>
mkdir <newdir>
Make a new directory called <newdir>
rmdir <dir>
Remove an (empty) directory
More Commands
who
List who is currently logged on to the system
whoami
Report what user you are logged on as
ps
List your processes on the system
ps aux
List all the processes on the system
File Permissions
Every file
Is owned by someone Belongs to a group Has certain access permissions for owner, group, and others Default permissions determined by umask
File Permissions
Every user:
Has a uid (login name), gid (login group) and membership of a "groups" list:
The uid is who you are (name and number) The gid is your initial login group you normally belong to The groups list is the file groups you can access via group permissions
File Permissions
Linux provides three kinds of permissions:
Read - users with read permission may read the file or list the directory Write - users with write permission may write to the file or new files to the directory Execute - users with execute permission may execute the file or lookup a specific file within a directory
File Permissions
The long version of a file listing (ls -l) will display the file permissions:
-rwxrwxr-x -rw-rw-r--rw-rw-r-drwxrwxr-x 1 1 1 7 rvdheij rvdheij rvdheij rvdheij rvdheij rvdheij rvdheij rvdheij 5224 221 1514 1024 Dec Dec Dec Dec 30 30 30 31 03:22 03:59 03:59 14:52 hello hello.c hello.s posixuft
Permissions Owner
Group
-rwxrwxrwx
Other permissions Group permissions Owner permissions Directory flag (d=directory; l=link)
Additional Resources
http://www.linux.org http://www.tux.org http://www.li.org