We think you have liked this presentation. If you wish to download it, please recommend it to your friends in any social system. Share buttons are a little bit lower. Thank you!
Presentation is loading. Please wait.
Published byEmerald Booth
Modified over 5 years ago
©Colin Jamison 2004 Introduction to Linux Colin Jamison
©Colin Jamison 2004 Help on Unix Commands List all options available for a command and also some example usage e.g. man command-name As for ‘man’ but the ‘info’ command has more information and is up to date e.g. info command-name
©Colin Jamison 2004 UNIX Command Format command The first word is the command Options follow commands Commands/options/arguments are case sensitive A command may or may not have options $ ls $ ls -al Arguments are normally files/directories $ ls -al /etc
©Colin Jamison 2004 Directory and File Names Case sensitive Any character Avoid “ / * > space ! ” –they are legal but their use is problematic with shells Must be unique inside its directory Wildcard – *any number of characters – ?any single character – [ ]Any one of the characters inserted between the brackets
©Colin Jamison 2004 Path Names Path name - is an address that uniquely identifies a file or directory in the UNIX file system. Absolute path name - always starts from the root directory e.g. /usr/local/bin Relative path name - path relative to the present working directory e.g. if pwd is /usr relative pathname local/bin is equivalent to the absolute pathname /usr/local/bin
©Colin Jamison 2004 Directory Navigation Changing directory $ cd /usr $ cd local/bin $ cd.. Present directory $ pwd /home/cjamison/ Creating/removing directories $ mkdir directoryname $ rmdir directoryname
©Colin Jamison 2004 Directory Contents File listing $ ls - abbreviated list $ ls -a - abbreviated list + hidden files $ ls -al - long list + hidden files $ ls -F - abbreviated list + file type
©Colin Jamison 2004 bash2.04$ ls -l total drwxr-xr-x 1 cjamison staff 123 Dec 12 2003 Aproject -rwx--x--x 1 cjamison staff 514 Dec 24 2003 Ascript -rwxr--r-- 1 cjamison staff 2345 Jan 02 2004 afile -rwxr--r-- 1 cjamison staff 231 Aug 12 2003 checksum -rwxr-x--x 1 cjamison staff 126 Dec 24 1990 dos2unix -rwx------ 1 cjamison staff 732 Oct 23 2003 dev.txt -rwxr-x--x 1 cjamison staff 9470 Aug 26 2003 excalibur drwxr-x--x 1 cjamison staff 512 Dec 10 2003 home drwx------ 1 cjamison staff 512 Jan 16 2004 mp3 drwx------ 1 cjamison staff 512 Sep 01 2003 payroll -rwxr-x--- 1 cjamison staff 8972 Aug 21 2003 swallow -rw------- 1 cjamison staff 42 Dec 24 2003 swift.txt bash2.04$ File listing type access permission owner group size date and time last modified name
©Colin Jamison 2004 Access Permissions Access permissions on a directory determine whether a file in the directory can be renamed or removed File permissions determine what can be done to the file contents To allow access to a directory, access permissions should be set for all of its parent directories all the way up to the root directory
©Colin Jamison 2004 Access Permissions The first character indicates the type of file: –directory (d) –link (l) –plain file (-) -rwxrwxr-x l The rest, specify three types of users m owner m group m others l who are allowed to m (r) read m (w) write m (x) execute
©Colin Jamison 2004 Numerical Access Permissions -|rwx|r-x|r--| |111 |101|100| Character Binary Octal | 7 | 5 | 4 |
©Colin Jamison 2004 Protecting Your Files -r-- --- --- (400) protect it from accidental editing -rw- --- --- (600) owner can edit/read the file -rw- r-- r-- (644) owner can edit, others may read -rw- rw- rw- (666) everyone can edit/read dr-x r-x r-x (555) everyone can list but can’t create delete/rename files drwx --- --- (700) owner can do anything drwx r-x r-x (755) owner can do anything, others can read drwx rwx rwx (777) anyone can edit/read/run
©Colin Jamison 2004 Changing Access Permissions chmod permission files Character Method $ chmod a=r-x filename $ chmod u=rwx filename $ chmod go+r filename $ chmod ugo-w filename Numerical Method $ chmod 755 filename $ chmod 600 filename
©Colin Jamison 2004 Viewing and Editing Files Listing files –cate.g. cat filename –taile.g. tail -f filename Listing files one screen at a time –moree.g. cat filename | more Editing files –vi –emacs –GUI tools
©Colin Jamison 2004 File Manipulation Copy –cp filename1 filename2 move (rename) –mv filename directory remove (delete) - be careful! –rm filename
©Colin Jamison 2004 Listing Processes List processes e.g. ps ps -ef
©Colin Jamison 2004 Processes - Foreground v Background To run a process as a background process: process-name & To examine foreground/background processes use the jobs command fg bg Each process has a unique process id (PID)
©Colin Jamison 2004 Disposing of Rogue Processes The kill command kill parameter PID parameters ‘-1’ to ‘-9’ PID available from one of the process commands
©Colin Jamison 2004 Redirection (1) ls -al > lsoutput1.txt ls -al >> lsoutput2.txt file descriptors standard input 0 standard output 1 standard error 2
©Colin Jamison 2004 Redirection (2) Redirect standard error to a file ls -al > lsout.txt 2>lserror.txt redirect standard output and standard error to the same file ls -al > lsout.txt 2>&1 Redirecting input more < lsout.txt To discard standard output and standard error ls -al > /dev/null 2>&1
©Colin Jamison 2004 Pipes Simplify redirection e.g. ps | sort | more ps | grep ‘sh’ > listshells.txt
©Colin Jamison 2004 ‘C’ Tools (gcc) gcc - GNU C/C++ compiler gcc filename1 … filenameX -o programfilename most commonly used options [-Idir...] search dir for header files [-Ldir…] include dir to search for library ( -llibrary ) [-o outfile] [-ggdb] include gdb debugging information
©Colin Jamison 2004 ‘C’ Tools (gdb) gdb - GNU debugger gdb programfilename most commonly used options run break [file:]functionprint expr next step c edit [file:]function list help command quit
©Colin Jamison 2004 Questions ?
By: Tony Andrews. Linux directory ordering system Navigating and creating directories ◦ Listing directories and files ◦ Creating directories ◦ Changing.
Introduction to the Omega Server CSE Overview Intro to Omega Basic Unix Command Files Directories Printing C and C++ compilers GNU Debugger.
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Introduction to UNIX Cornell University CS 316 – Fall 2006 Slides by Michael Siegenthaler.
Unix. Outline Commands Environment Variables Basic Commands CommandMeaning lslist files and directories ls -alist all files and directories mkdirmake.
1 Introduction to UNIX Ke Liu
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
The UNIX File System CS465. File Systems What is a file system? A means of organizing information on the computer. A file system is a logical view, not.
Linux+ Guide to Linux Certification, Second Edition
More Shell Basics CS465 - Unix. Unix shells User’s default shell - specified in /etc/passwd file To show which shell you are currently using: $ echo $SHELL.
CS4315A. Berrached::CMS::UHD1 Quick UNIX Tutorial.
1 Basics of Linux On linux machine: Login at your home directory Open a “shell” or “terminal” or “xterm” workspace (4) On windows machine Intall linux.
Unix Basics. Systems Programming: Unix Basics 2 Unix Basics Unix directories Important Unix file commands File and Directory Access Rights through.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
Linux Commands LINUX COMMANDS.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Systems Programming Concepts
Introduction to Linux Workshop February Introduction Rob Lane & The HPC Support Team Research Computing Services CUIT.
1 THE UNIX FILE SYSTEM By Chokechai Chuensukanant ID COSC 513 Operating System.
Unix Primer. Unix Shell The shell is a command programming language that provides an interface to the UNIX operating system. The shell is a “regular”
© 2021 SlidePlayer.com Inc. All rights reserved.