210 likes | 371 Views
UNX122 – Unix File System. http://www.worldwidelearn.com/free-online-training.htm?cobrand=wwl&vs_category=11 - Free online tutorial for linux ** http://www.linux-tutorial.info/cgi-bin/display.pl?224&0&0&1&3 - Good site for Linux tutorials
E N D
UNX122 – Unix File System • http://www.worldwidelearn.com/free-online-training.htm?cobrand=wwl&vs_category=11 - Free online tutorial for linux ** • http://www.linux-tutorial.info/cgi-bin/display.pl?224&0&0&1&3 - Good site for Linux tutorials • http://www.linuxnewbie.org/ - website and discussion forum for newcomers = CLICK on FORUM • http://www.deja.com - archive of many newsgroups - great depository of information • http://acs.senecac.on.ca - click "info centre"==>"SmartHelp"==>Tutorials==>Software==>Linux
Parts of the UNIX System • Kernel – Unix programs which control and schedule processes and resources, also called Operating System. • Shell – The interface where users use utilities or applications to interact with the kernel (bash, tcsh, ksh). • Utilities – 100’s of commands used to manipulate and interact with various components of Unix. • File System – Linux ext3, vfat (dos compatible). • Devices – Physical resources used for processing Input and Output. • Networking – Connect remotely to any other computers using the TCP/IP protocol.
Login – init, getty, login, prompt • init – kernel activates a user request for terminal resources. • getty – terminal resources allocated to the user. • login – First level of security is the login prompt. • login prompt asks users to enter username and password • root - superuser • normal user
Login shell, home, bash, ksh, tcsh • shell – command line interface, user can type commands to interact with the Unix Operating System • users home dir • bash = Bourne Again Shell • ksh = Korn Shell • csh = The C Shell
Shell Prompt • structure of the prompt • $ = normal user account • # = superuser account • > = prompt to complete the current command • Prompt eg. [rudy@localhost rudy]> • File and Directory permissions: users, groups and other
Basic commands - exit, pwd, passwd, clear • Unix is CASE SENSITIVE. • commands – users enter commands at prompt to interact with the operating system. • exit = to exit the shell and get back to the login prompt • date = show dates in various formats • passwd = change password, enter new password twice • higher security = use a mix Uppercase and numbers • clear = clear screen
More Basic commands – date, cal, cat • command syntax = verb [options] [argument list] • cal = show calendars for any year and month combination • cat <filename> = display CONTENTS of a file • Options: • -n = show line numbers in output • ls = display contents of a folder or directory showing File Names only.
Unix File System • Describe the Unix file system: • Hierarchical file system, pyramid structure, where everything starts at the top or root. • root is shown as “/”. • Sub folders are shown extending from root. • Each sub folder can contain folders and files. • Special notation: “.” = current directory and “..” = previous directory.
UNIX Standard directories 1 • / = original space of the entire file system containing all other files and directories. • /bin = commands, utilities and programs needed for system startup. • /boot = kernel and boot loader programs such as LILO • /dev = system devices listed eg. disk drives, cdrom, printer. • /etc = system configuration files • eg. system users and passwords, networking config files. • /etc/X11 = config files for the X Windows System • /home = home dir of users.
UNIX Standard directories 2 • /sbin = system admin commands and utilities needed for system startup. • /usr = all programs, libraries, shared data and system files • /proc = Kernel and the virtual file system containing process information. This is not a hard location on disk, but exists only in memory. • /root = home dir of system administrator called root.
UNIX Standard directories 3 • /lib = shared libraries used by utilities and other programs. • /mnt = temporary mount points of additions to the file system • /opt = Additional applications • /tmp = temp. files • /var = variable data like mail, logs, temp files, print spools.
What is a File? • What is a file? • a group of enclosed data stored as one entity with one name. • made up of bits and bytes or ones and zeros. • ordinary files and directory files • links = hard links point to an inode on disk, soft links point to a file. • directory or folder = place to store files, is considered a file itself. • hidden files = filename starts with “.”
Sample file listing Phobos: /students/rmahara2>$ ls -ld [mnop]* drwx------ 2 rmahara2 student 512 Jul 17 2002 mail -rw-r--r-- 1 rmahara2 student 15 Feb 12 2003 mailtxt -rwx------ 1 rmahara2 student 2038 Jul 21 2002 mbox -rwx------ 1 rmahara2 student 1085 Jul 15 2002 menu -rw-r--r-- 1 rmahara2 student 174257 Jul 02 20:08 myerr -rw-r--r-- 1 rmahara2 student 208896 Jul 02 20:08 myf -rw-r--r-- 1 rmahara2 student 25 Jun 18 22:04 myfile -rw-r--r-- 1 rmahara2 student 45 Jun 18 22:10 myfile1 -rwxr-xr-x 1 rmahara2 student 1366 Jul 02 16:19 ops2235 drwxr-xr-x 2 rmahara2 student 512 Jul 02 19:46 ops235 drwx------ 8 rmahara2 student 512 Jul 16 2002 ops240 -rw-r--r-- 1 rmahara2 student 1603 Feb 12 2003 passfil -rwx------ 1 rmahara2 student 606 Jul 15 2002 phone -rwx------ 1 rmahara2 student 306 Jun 19 2002 phone.bkp -rwx------ 1 rmahara2 student 896 Jul 13 2002 phonelist -rwx------ 1 rmahara2 student 896 Jun 19 2002 phonelist.bkp -rwx------ 1 rmahara2 student 905 Jan 15 2003 profile.rudy Phobos: /students/rmahara2>$
File – naming rules • Use the following characters for file names: • A-Z, a-z, 0-9, “underscore", “dot”, “comma “ • AVOID the following characters for file names: • /, @, #, $, %, ^, &, *, (, ), [, ], {, }, ~, “, `, ‘ • maximum 255 characters. • file names cannot be duplicated in the same folder
File Commands: ls options • ls = display contents of a folder or directory showing File Names only. • options: • -a = show all files, including hidden files. • -l = show file details but not hidden files. • -d = show current directory only • -F = shows: • / after directories • * after executable files • nothing after regular files
File commands: more, mv • more <filename> = display contents of a file, allows scrolling one screen at at time. • [spacebar] to see next screen • q = quit more display • less = (Linux) the same as more but allows scrolling in both backward and forward directions. • cp <source> <target> = make an exact copy of a file or folder • mv <file or dir name> <new file or dir> = move or rename a file or dir
File commands – mkdir, cd, rmdir, rm • mkdir = create a directory. • Options: • -p = create folders in between to complete the path. • cd = change into a directory • rmdir = removes an empty directory • rm <filespec> = delete file • Options: • -i = interactive mode, asks user for confirmation.\ • -r = recursive – delete all sub-directories.
File path – absolute, relative • Absolute = file path starting from root is specified. • eg. /home/mary/mail.conf • Relative = file path with reference to current position is specified. • eg. ../mary/assignment.txt
Help – man, whereis • How to get help - Documentation & Help files: • man <command name> • [section number] = specific section of man pages • h = display help in using man display • q = exit man display • - man -k <string> = look for string in <k> section of man pages • eg. man -k calendar • whereis <command> = lists all directory paths that contain binary files for a command • eg. whereis mv
Help – man sections The man pages are divided into different sections. Table below shows the more common sections that Linux uses. Different versions of UNIX use slightly different sections. Section# - Contents 1 - user commands 3m - arithmetic library 4 - special files 5 - file formats 7 - miscellaneous 8 - administration and privileged commands
Help - which, apropos • which <command> = lists only one directory path of the command. • apropos <command> = • apropos copy = show commands which relate to copy • HowTo's • linux / UNIX news groups