0% found this document useful (0 votes)
39 views

Introduction To Linux: Lei Zhang UCLA Linux Users Group

Linux is a free, open-source operating system developed in 1991 by Linus Torvalds. It provides multi-tasking capabilities and stability. Key advantages of Linux include being free, open-source, portable, and providing a complete development environment. The filesystem is organized in a hierarchical tree structure with directories like /home for user files and /usr for programs. Users can interact with Linux through a command line interface or graphical user interfaces like GNOME and KDE. Common commands include ls to list files, cd to change directories, and man to view manuals. Processes run and basic file and directory operations are also summarized.

Uploaded by

Nadiir Adan
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

Introduction To Linux: Lei Zhang UCLA Linux Users Group

Linux is a free, open-source operating system developed in 1991 by Linus Torvalds. It provides multi-tasking capabilities and stability. Key advantages of Linux include being free, open-source, portable, and providing a complete development environment. The filesystem is organized in a hierarchical tree structure with directories like /home for user files and /usr for programs. Users can interact with Linux through a command line interface or graphical user interfaces like GNOME and KDE. Common commands include ls to list files, cd to change directories, and man to view manuals. Processes run and basic file and directory operations are also summarized.

Uploaded by

Nadiir Adan
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

Introduction to Linux

Lei Zhang UCLA Linux Users Group


http://linux.ucla.edu/~leiz/linuxintro.ppt

What is Linux?
UNIX-like Operating System Developed by Finnish computer science student Linus Torvalds as an OS project in 1991. Made available on the net and has been developed ever since

Why Use Linux?


Multi-Tasking / Multi-User Stability / Reliability Portable Comes with a complete development enviroment (C, C++, Fortran, Java, Perl, Python, etc...)

Why Use Linux?


It's Free Software
Free as in beer Free as in speech

It's Open Source


You can see the source code You can modify the source code

Users in Linux
Every User has: username, group(s), password, home directory Root User vs Regular User
Root == Administrator == God
Use sparingly, only when necessary Remember, it's your bed, don't Sh** in it

Regular Users
Limited privileges

Home Dir and Path


Home Directory
Location of user files Start point when logging in

Path
Used to search for commands Colon separated e.g. /usr/bin:/bin:/usr/X11R6/bin

The filesystem (fs)


Linux supports many filesystems
Native fs (ext2, ext3, reiserfs, etc)
UNIX permissions, links, special devices

Microsoft fs (fat, ntfs)


Read/write support for fat, readonly for ntfs

Network fs (nfs, smb, afs, etc)


Support for accessing files on other computers

Structure of fs
The fs is conceptualised as a tree / is the root directory and everything is a subdirectory of it branching downwards Other drives are attached to the tree
No C drive Attach other filesystem using the mount and umount command
umount is the unmount command, not a typo Normally only root can (un)mount

Tree Structure
root directory / essential user programs /bin kernels and boot loader /boot device files /dev configuration files /etc home directories /home essential libraries and kernel modules /lib mount point for other filesystems /mnt addon (optional) software /opt system internals /proc the root user's home directory /root essential system binaries /sbin temporary files /tmp user programs (not as essential) /usr /usr/bin | similar hierachy to root dir /usr/lib /usr/sbin various other files (logs, mail, etc) /var

Types of files
Everything is a file! Ordinary files - text, data or programs Directories - contain other files/directories Links - pointers to other files Special files
Devices - represent hardware (e.g. /dev/fd0) Others - pipes, sockets

The Linux User Interface


Command line interface (CLI)
Command line type commands at a prompt Can be more flexible / powerful

Graphical user interface (GUI)


Point and click windows interface Familiar / easy to use

The GUI
X Window System
underlying graphics system

Desktop Environments (the actual GUI)


e.g. KDE, GNOME

Useful Apps
Konsole runs a shell (the CLI) OpenOffice wordprocessor/spreadsheet Mozilla Web Browser Gaim AIM / MSN / Yahoo IM client

The Shell (CLI)


Command Interpreter Runs programs on the user's behalf varieties csh, tcsh, bash, zsh, etc
Bash is the most popular

The prompt e.g.


user@computer:/current_dir$

Command Line Cycle


Display Prompt User types command and enter Shell executes the command

Getting Help (The Manual)


Man command man sections:
1. User Commands 3. Library Calls 5. File Format + conversion 7. Miscellaneous n. New 2. System Calls 4. Devices 6. Games 8. System Management

e.g. man 3 printf

ls output
Permissions links owner owners group size of file/dir date of last modification name of file/dir

Permissions
Multi-user OS needs access mechanism for files Each file/dir has permissions for its owner, its owners group and everyone else on the system (u,g,o) The permissions are for the ability to read, write and execute a file/dir

RWX
Output of ls -l if permission is on a letter appears if it is off there will be a minus sign (-) first one is - for a file or d for dir next 3 are the users perms next 3 are the groups perms last 3 are everyone else's perms

Examples of permissions
-rw-r--r-dr-xr-xr-x -rwxr-xr-lrwxrwxrwx foo bar prog.c prog

Changing permissions
Chmod command - has 2 modes
number (convert bits to decimal number)
directly set the permission read = 4, write = 2, execute = 1 e.g. 750 is equivalent to rwxr-x---

add/remove perms: {a,u,g,o} {+,-} {r,w,x}

chmod permission <filename>


e.g. chmod a+x foo e.g. chmod 644 bar

Navigation
Absolute - full pathnames (/) Relative - pathnames relative to were you are in the fs (. .. ~) Shortcuts
. is current directory .. is the parent of current directory
~ is your home directory

Wildcards and Filename completion


The wildcard character is * and matches zero or more characters.
*.txt = all files that end in .txt a* = all files that start with the letter a d*.c = all files that start with d and have .c at the end

Filename completion - type first few characters of a file/command and press tab, the shell will fill in the rest

Basic commands
cd change directory
e.g. cd /usr/bin

cp copy files
e.g. cp ~/cs111/source.c /mnt/floppy

mv move files
e.g. mv /tmp/mystuff/* ../somewhere

rm remove files
e.g. rm ee115c/hwk*

mkdir, rmdir make and remove directories

Standard input/output
3 special file handles for input/output of programs
standard input (stdin) file handle 0 standard output (stdout) - file handle 1 standard error (stderr) - file handle 2

By default for programs:


stdout and stderr are the screen stdin is the keyboard

Pipes
The pipe character is: | The output of the command on the left of the pipe becomes the input to the command on the right
ls | wc -l output of ls as input to wc

Can create complex commands to perform difficult tasks

Processes
ps command lists processes on the system
e.g. ps auwx shows all processes running on the system at the time

Processes can be killed


Using the kill command
You must be owner of process, or root e.g. kill 500 will kill process #500 Can also be used to send processes signals

Compiling Programs
gcc GNU C Compiler Simple compiler usage
gcc o hello hello.c

Compile only
gcc c hello.c gcc c functions.c

Link files together


gcc o newhello hello.o functions.o

Run the program


./hello

Network Utils
ping - tells if a machine is on the network
e.g. ping www.ucla.edu will keep sending packets until CTRL + C

traceroute - shows all points between machine and machine you are looking for
e.g. traceroute www.yahoo.com shows all the hops to yahoo

netstat - show network connections

The End
(For Now)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy