Course 102: Lecture 3: Basic Concepts And Commands
Linux Administration in 10 Minutes
1. LINUX SYSTEM
ADMINISTRATION
In 10 Minutes
Monday, December 3, 12
2. DIRECTORIES
•/ “root” directory
• /usr directory of usr (sub directory of “/” root)
• /usr/STRIM100 STRIM100 is a subdirectory of /usr
Monday, December 3, 12
3. MOVING AROUND
• pwd
Show the “present working directory”
• cd
Change directory
• cd /usr/STRIM100
• cd ..
Move to the parent directory of the current directory
Monday, December 3, 12
4. LISTING FILES
• ls
List a directory
• ls -l
List a directory in a long format
• ls /usr
List the /usr directory
Monday, December 3, 12
5. CHANGING FILE PERMISSIONS
• chmod 755 FILE
Changes the file to be rw for the user and ro for group/world
• chgrp user FILE
Make the FILE belong to the group “user”
• chown cliff FILE
Makes cliff the owner of FILE
• chown -R cliff DIR
Makes cliff the owner of DIR and everything inside of it
Monday, December 3, 12
6. MOVING, RENAMING,
COPYING
• cp file1 file2 • rm
file1
Copy file1 to file2 Remove or delete file1
• mv file1 newname • rm -r dir1
Move or rename a file Recursively delete a
directory and it’s contents
• mv file1 ~/AAA/
Move file1 to AAA directory • mkdirdir1
Create a directory
Monday, December 3, 12
7. VIEWING AND EDITING FILES
• catfile • vifile
Dump a file to the screen Edit file with vi. Also try
“nano”
• more file
Dump a file to the screen • head file
line by line Show the first few lines of a
file.
• less file
Like more but with paging • tail
file
Show the last few lines
Monday, December 3, 12
8. INTERACTIVE HISTORY
• You can use the Up arrow key to access previous commands,
edit and re-execute them.
Monday, December 3, 12
9. FILENAME COMPLETION
• You can use TAB to complete a partially typed command or
filename
• TAB twice will show you all of your available options
Monday, December 3, 12
10. REDIRECTION
• grep string filename > newfile
Redirects the output of the “grep” command into a new file
called “newfile”
• grep string filename >> newfile
Appends the output of the “grep” command to the end of
“newfile”
• mysql database < dump.sql
Sends the commands from the SQL file into MySQL
Monday, December 3, 12
11. PIPES
• The pipe symbol “|” is used to direct the output of one
command into the input of another
• ls -l | more
ls is now viewable line by line
• du -sc * | sort -n | tail
Shows the largest files in the current directory
Monday, December 3, 12
12. SEARCHING FILES
• grep STRING FILENAME
prints all the lines of a file that contain string. Wildcards can be
used, along with the -r flag
Monday, December 3, 12
14. LOOKING FOR HELP
• man
Short for “Manual”
• man ls
• man grep
Monday, December 3, 12
15. PACKAGE MANAGEMENT
• yum update
Query all of the configured software sources for updates
• yum install PACKAGENAME
• yum search PACKAGE
Monday, December 3, 12
16. VIRTUAL BOX
• virtualbox.org
Free virtual machine host, run other operating systems inside a
window on your own machine.
• CentOS - centos.org
Worf runs CentOS 5. Free download and runs great in
Virtualbox
Monday, December 3, 12