2. Topics
• Command-Line Basics
• Permissions
• Using the man Command
• Hard and Soft Links
• Network settings
• Creating RPMs
• Repositories and working with YUM
• Kernel Modes
• Resizing Partitions
4. Navigating Files and Directories
man <command> manuals lists information about the command
ls list lists all non-hidden contents of a directory
cd <directory> change directory moves into a directory located within
current directory
cat <file> concatenate files print file contents to screen
cp <file1> <file2> copy creates a new file2 with file1 contents
rm <file name> remove removes the file
mv <file1> <new filename> move renames file1
mv <file1> <location> move moves file1 to a new location
cd .. change directory moves up a folder
mkdir <new directory name> make directory makes a new directory
pwd print working directory lists pathname of the current directory
cd ~<username> change directory move into the home directory of user
cd <directory path> change directory moves into the directory
rm -r <directory name> remove recursively removes a directory and its contents
5. Tar Archiving and Gzip Compression
Archiving - grouping multiple files together in a single file to save space
and make it easier to transfer the files around
Compressing - replacing a single file with a smaller/compressed
version to save space
Tar - a type of archiver most common to Linux
Gzip - a type compressor most common to Linux
To extract .tar.gz files:
tar -xvzf <filename>
tar -xvzf example.tar.gz
To create a new .tar.gz file:
tar -cpzf <filename> <foldername>
tar -cpzf newArchive.tar.gz images
6. Users and Groups
Command Definition Purpose
su substitute Similar to logging into your computer
user as administrator
useradd <username> user add adds a new user
passwd <username> password changes or creates new password
groupadd <groupname> group add creates new group
usermod <options> <username> user modify modifies the user
Ex. adding user to group
userdel <username> user delete deletes a user
groupdel <groupname> group delete deletes a group
7. Permissions Format
• A permission has a total of 10 characters.
• There are no empty spaces
ugo
Permission Format
u - user/owner
g - users of the owning
group
o - any other user
8. Permissions Characters
Identifier categories
• - file identifier
• d directory identifier
rwx categories
• r read (able to open/view files as well as view contents of folders)
• w write (able to edit/rename/save files and folders)
• x execute (able to run a program)
• - place holder (does not have the privilege)
9. Permissions Commands
• Changing permissions can be done with the command chmod in the terminal
Command Definition Purpose
ls -lh list lists a long humanly
readable list of all files
chmod <u,g,o> <+,-,=> <r,w,x> change mode changes permissions of
files
• chmod can be used with multiple modifiers
Modifier Purpose
+ adds to current permissions
- takes away from current
permissions
= erases previous permissions and
sets new ones
10. Permissions
• You can set who can access specific files by changing user
and group owner
• The superuser (root) has full access and can change any
permission, even for files that don't belong to the root
account.
Command Definition Purpose
chown <username> <filename> change owner changes the owner of a file
chgrp <groupname> <filename> change group changes the group owner
of a file
11. The man command
• The Linux man pages are the most helpful
tool to the for the test.
• The above is a manual page for the ls
command
12. Strategies and Use
• The manual pages are organized in the order:
– Name, Synopsis, Description, and Options
• The options are organized into subcategories:
– User Commands, System Calls, C Library Functions,
Devices and Special Files, File Formats and
Conventions, Games, Miscellanea, System
Administration.
• If you know what you are looking for and where to look it
saves a lot of time
• Syntax for the command is as follows:
man <command> <options>
man –k <something> | less
13. Strategies and Use
• Once you are in a man page, there are other ways
to help narrow down what you are looking for.
• By typing /<search parameter> and hitting Enter,
you can search for key words within the manual.
Sequentially typing / and hitting Enter bring up the
next occurrences of your search.
14. Strategies and Use
• When searching, pressing the space bar will take
you down one page and help ensure you don’t
miss anything
• To close a manual page, type q or hit ctrl-c which
is the stop current command hot key
• One other method for finding the correct command
is through /sbin where all the executable
commands are stored. Scrolling through the list
with | less can help jog a person’s memory
15. Hard and Soft Links
• Every file has two parts, a data structure and file
name structure.
• The data structure is associated with an inode.
• The file structure is the name and the associated
inode number that references where the data is
stored.
• A hard link refers to more than one file with the
same inode number.
• A soft link is a reference to another file or directory
with a different inode number than the original file.
16. Hard and Soft Links
• ls –lia Shows inode numbers of files
Create hard links
• ln <source-filename> <link-filename>
Create soft Links
• ln –s <source-filename> <link-filename>
17. Network Settings
To display the current network settings, use the command:
ifconfig
This will list all the different interfaces. Choose the one you want and
use the command:
ifconfig <interface> <ip address> netmask <netmask> up
To set the default connection, use the command
route add default gw <default gateway>
To set the DNS, modify the /etc/resolv.conf with the vi or grep text
editor.
It should resemble nameserver <DNS Address>
To configure network with DHCP, run the command dhclient –r which
will release the current client. After run dhclient to obtain a new IP.
18. Creating RPMs
RPM is the package management system used by Red Hat
Enterprise Linux and many other Linux distributions.
Basic Usage:
$ rpm -ivh demofile-1.0.0-i386.rpm
i for install, v for verbose, h for process hash
$ rpm -ql demofile
q for query, l for list files
$ rpm -e demofile
e for erase
Setup:
$ mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
$ mkdir -p ~/rpmbuild/RPMS/{noarch,i386,i686}
19. YUM Repositories
Yellowdog Updater Modified
Package manager for .rpm files that allows the installation of new packages, removal of old packages, and
automatic system updates
yum install <application>
yum install nano
yum update <application>
yum update flash-plugin
yum update (no other parameters)
yum remove <application>
yum remove vim
yum list
20. Kernel Modes
• Within every Linux operating system there are the
six basic runlevels.
• The runlevel is the state of the machine after boot.
• A typical computer boots into runlevel 5. This
usually contains a GUI and networking.
21. Kernel Modes
• These runlevels can be accessed in three main
ways
– With the init command
– Modifying the /etc/inittab file that controls what
the computer boots into
– Changing command sent by the GRUB
Bootloader
**Note when running init command or modifying
innitab file, you need root privileges.**
22. Kernel Modes
• When you start up a computer, press any key to
load the grub menu when the loading screen
appears
• It will then take you to the GRUB menu
• Once in the menu, you can scroll up and down to
chose which version of Linux you would like to
load.
23. Kernel Modes
• You also have the option to open the grub
command line when you press c.
• To modify boot command, press e.
• To change the runlevel the computer boots into,
add a space at the end of the command and type
the runlevel code (1-6) and hit Enter
• Once loaded into one of the runlevels you can
modify the root password with passwd
• To change runlevels after loading into a runlevel,
use init <runlevel id #> (Root only).
24. Kernel Modes
• How is this secure?
• You can establish a GRUB menu password with
the command grub-md5-crypt, but this has its
drawbacks.
– If you forget GRUB password, you may need to
backup your computer and reinstall the
operating system through the BIOS and wipe the
hard drive.
25. Summary
• Command-Line Basics
• Permissions
• Using the man Command
• Hard and Soft Links
• Network settings
• Creating RPMs
• Repositories and working with YUM
• Kernel Modes
• Resizing Partitions
Linux is an open source operating system that developed from UNIX. Open source means that the source code of it is available for anyone to view unlike Windows or other operating systems where the source code is kept a secret. We will be focusing on the Fedora 15 distribution (formally known as Fedora Core) and its GNOME 3 GUI (which is the stuff you can actually see when you are clicking around on the desktop) that it comes with. GNOME isn't a standalone operating system itself. Fedora has a new release about every 6 months or so. Fedora 16 is scheduled for release for sometime this October. Each release includes a variety of new features and improvements.
Remove white from icons and touch up left and right feet for white outlines on john’s penguin. Find or create images for hard and soft links and kernel modes (run levels)
You can run your computer at different access levels at the same time. This is beneficial in the event that you yourself do not have the root password and you need access to another directory By using su to substitute the user after login, you can run multiple levels in terminal. Also, running underneath of the GUI, hidden from view are a set of consoles. You can use these to log into multiple accounts at one time. The hot key to access them is Ctrl + Alt + F2 - F6. ensure you have more than just root account before starting this process **live demo procedure** - Ctrl + Alt + F2 - log into pooleuser account - Ctrl + Alt + F3 - log into root account Control + Alt + F7 takes you back to the GUI view. You can switch back to the terminal windows at any time. - Ctrl + Alt + F7 There is also a terminal available in the GUI. *open terminal* To work in a terminal, you must know how to use commands. Commands are simply instructions given by the user, telling the computer to do something. The format of a command is command -options <arguments> . Commands normally have many options. This makes the command more flexible and allows you to better tell the computer what exaclty you want done. An argument is a filename or some other data given by the user to be used as an input with the command. To learn more about a command and its options, use the command man <command> to see the manual. Everthing done in the GUI can be done by commands in a terminal.
These are a few basic commands to navigate through your files in a terminal. You have these and more commands listed on your handout. cd <new directory> Moves you into that folder if it is inside of the folder where you are currently located. cd <full file path> Moves you to the path you specify. (can be anywhere as long as the path is correct) cd .. Moves you to the directory above the one you are currently located in. If you are inside of /home/pooleuser/Downloads, it would move you into /home/pooleuser. cd ~<username> Takes you directly to the home directory for the specified username. pwd Prints out the path of the directory you are currently located in. ls Lists all non-hidden files and folders that are inside of the directory you are located in. mkdir Creates a new directory with the name you provide. cp Copies a file and names the copy anything you want. rm Removes a file. rm - r Used to delete directories instead of files. The -r tells rm to recursively remove directories and their contents. mv Moves or renames a file or folder. note: folder and file names are case sensitive ensure that file named &quot;stuff&quot; is inside Documents folder before you begin the process **live demo procedure** - switch to terminal - ls command - cd Documents - ls - cp stuff stuff2 - rm stuff - ls - mv stuff2 stuff3 - ls - pwd - mv stuff3 /home/sdiviney - ls - cd .. - ls - mkdir Games - ls - cd Games - cd ~sdiviney - ls - rm -rf Games - ls - keep terminal open but open up add/remove software
When a directory is not going to be used for a while, or is being moved, people often change them into compressed archives to save space. An archive is a single file composed of many files. A compressed file is a smaller version of its original file. This archive file, in this case a .tar file, is essentially just a bundle of a group of files. It may come in handy if you need to, for example, submit a bunch of files. With an archive file, you only have to submit one rather than each and every file it contains. One way of creating an archive file is with the tar command. Tar was originally used to write to tapes and so its name comes from tape archive. Taring something will not effect your original files. Gzip is the most common way to compress files in Linux. Files archived with tar end in .tar, files compressed with gzip end in .gz, and compressed archives use both (.tar.gz). The tar command can compress/decompress gzip files with the -z option. -z used when you are performing an operation with gzip (either compressing or decompressing a archive) Tar also takes many other options. The most common are: -c create an archive file -x extract an archive file -t list the contents of an archive file -v (Verbose) prints out information to the screen as files and archives are processed -f allows you to specify the filename -p preserve file permissions when you compress them into the new archive To extract a .tar archive that hasn't been compressed with gzip, tar -xvf <.tar filename> . To extract a .tar.gz file that has been compressed with gzip, tar - xvzf <tar.gz filename> . To create a .tar archive from certain files or folders, tar - cvf <newarchivename <foldername/location> To list all of the contents of a .tar archive, tar -tvf <.tar filename> To create a .tar.gz (compressed) file from certain files or folders tar -pczf <newarchivename> <foldername/location> Tar is commonly used when installing new software. **live demo procedure** -
**live demo procedure** - make terminal active - su root - useradd guest - passwd guest - refresh user manager - switch back to terminal - groupadd pooleInterns - usermod -g pooleInterns guest - refresh user manager - close user manager (leave terminal open)
The format of the permission information looks like this. The first character is where the type (-,d,l) will be specified. After this are three spaces for the permissions of the user owner, the group owner, and finally for everyone else or others. If the user, group, or others possesses the permission to read, write, or execute, the letter will appear in its place. If not, a dash will appear as a place holder.
When you type the command ls -l, you will see a detailed list of everything in the current directory. The permissions information includes a dash, d, or l. This is to specify if it is a file, directory, or link. Also there will be a series of r, w, x and dashes. Every user and group has three permission options for a file. These are read, write, and execute. accomplished by using the terminal. *leave user manager open but push to back*
The permissions of a file can be changed using the command chmod. Permissions can be added (+), taken away (-), or set to (=). check to make sure that you have completed the live demo for file navigation and that stuff3 is located inside of the home folder before you begin **live demo procedure** - open terminal window - ls -l - chgrp pooleInterns stuff3 - chown guest stuff3 - ls -l - chmod ugo+rwx sutff3 - ls -l - chmod o-rwx stuff3 - ls -l
All files and directories have a user owner and a group owner. By default, this is the user who created it and the group that use is in. A file's user owner can be changed with the chown command and their group owner can be changed with the chgrp command.
They are your own personal cheat sheet. Learning how to use the command is by far one of the most crucial parts of the test because if you forget how to do something, the manual pages may jog your memory and make the difference between a pass and a fail. So how do they work? Just about every shell command has a man page of varying degrees of length.
The man command may seem like a very simple command; however, it is much more intuitive than one may think which makes it very useful. All the organization is visible if you man the man command. The syntax can be as simple or complicated as you want.
Because they both reference the same data, modifying anythign about one file will change the hard link as well. If you delete the original file, the hard link will still work. Hard links cannot link directories. A soft link does not share change like a hard link, adapting new permissions when the original file or directory is modified. It is helpful because you can associate many file names with one file. If the original file is deleted, the soft links will not longer work.
If you do not have a GUI, your IP can also be configured in a text based GUI (TUI) through the terminal. Once it is up, navigate through, choosing your ethernet card and IP address. Interface statuses can be checked with the ifconfig command. If no arguement is given, the current working interface information will be output. **Live Demo Open up terminal run ifconfig talk about all the information that is displays run through the GUI
RPM stands for RPM Package Manager. This package manager allows the installation of .rpm files. YUM is a package manager based on rpm that allows the installation of new packages, removal, and automatic system updates. YUM is very powerful in that it automatically searches for and installs all dependencies needed for a program. RPM will not do this. Many people prefer YUM to RPM simply because of the dependencies issue. If a program has many dependencies, you will have to manually install each one with RPM and it could take you a very long time. yum install <application> searches for, downloads, and installs the package you specify yum update <application> finds the package on your computer and downloads/installs updates for just that package yum update (no parameters) updates all packages you have installed on your computer that are not up to date. yum remove <application> uninstalls a specific package that you have on your computer yum list displays a list of all packages you currently have installed rpm -Uvih <package name> installs a .rpm file that is stored on your hard drive U - upgrade: checks to make sure the package you are about to install is the most recent version v - verbose: prints out useful information about the installation as it is progressing i - install: tells rpm that you are installing a new package h - hash: makes the display easier to read by separating out things with dashed lines
RPM stands for RPM Package Manager. This package manager allows the installation of .rpm files. YUM is a package manager based on rpm that allows the installation of new packages, removal, and automatic system updates. YUM is very powerful in that it automatically searches for and installs all dependencies needed for a program. RPM will not do this. Many people prefer YUM to RPM simply because of the dependencies issue. If a program has many dependencies, you will have to manually install each one with RPM and it could take you a very long time. yum install <application> searches for, downloads, and installs the package you specify yum update <application> finds the package on your computer and downloads/installs updates for just that package yum update (no parameters) updates all packages you have installed on your computer that are not up to date. yum remove <application> uninstalls a specific package that you have on your computer yum list displays a list of all packages you currently have installed rpm -Uvih <package name> installs a .rpm file that is stored on your hard drive U - upgrade: checks to make sure the package you are about to install is the most recent version v - verbose: prints out useful information about the installation as it is progressing i - install: tells rpm that you are installing a new package h - hash: makes the display easier to read by separating out things with dashed lines
Each runlevel has a specific purpose. 0 shuts down the machinem, 2 and 3 are like windows safe mode, with and without networking. 4 is not typically used. 5 is the normal run level and 6 will reboot the machine. Run level 1 is, however, very significantly different from the other runlevels because unlike the rest, it gives complete access to root user privileges. What this means is you can do anything, including change the root password. The general purpose for the other runlevels is for troubleshooting when the system is having problems, or you forgot your root password.
Conclusion: Switching to Linux has advantages and disadvantages. This free, secure system has many distributions to chose from, though it may be annoying for you to switch over. This concludes our presentation. We hope that it was informative and helped open your eyes to other options when choosing an operating system. Questions?