Tony Kombol.  man  on-line user manual  man command_you_want_info_on  type q to exit  examples:  for ls (list directory) ▪ man ls  for cp (copy)

Slides:



Advertisements
Similar presentations
RH030 Linux Computing Essentials
Advertisements

Tony Kombol.  A program that  receives commands from a text input device (e.g. keyboard)  passes them to the operating system to perform  In the.
Jump to first page Unix Commands Monica Stoica Jump to first page Introduction to Unix n Unix was born in 1969 at Bell Laboratories, a research subdivision.
Chapter One The Essence of UNIX.
PacNOG 6: Nadi, Fiji Using Commands in Linux Hervey Allen Network Startup Resource Center.
1 Introduction to UNIX Ke Liu
NETW-240 Shells Last Update Copyright Kenneth M. Chipps Ph.D. 1.
Linux File & Folder permissions. File Permissions In Ubuntu, files and folders can be set up so that only specific users can view, modify, or run them.
Introducing the Command Line CMSC 121 Introduction to UNIX Much of the material in these slides was taken from Dan Hood’s CMSC 121 Lecture Notes.
1 CSE 390a Lecture 4 Persistent shell settings; users/groups; permissions slides created by Marty Stepp, modified by Jessica Miller
1 CSE 303 Lecture 4 users/groups; permissions; intro to shell scripting read Linux Pocket Guide pp , 25-27, 61-65, , 176 slides created by.
Lesson 22 – Introduction to Linux Systems Administration.
Linux+ Guide to Linux Certification, Second Edition
Lecture 02CS311 – Operating Systems 1 1 CS311 – Lecture 02 Outline UNIX/Linux features – Redirection – pipes – Terminating a command – Running program.
Linux Installation and Administration Lesson 2 Tutor: George Papamarkos.
Introduction to Linux Workshop February Introduction Rob Lane & The HPC Support Team Research Computing Services CUIT.
Using the “CLI” Unix / Linux Preparation Course May 25 Djibouti.
Filesystem Hierarchy Standard (FHS) –Standard of outlining the location of set files and directories on a Linux system –Gives Linux software developers.
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”
Chapter 9 Part II Linux Command Line Access to Linux Authenticated login using a Linux account is required to access a Linux system. The Linux prompt will.
Guide to Linux Installation and Administration, 2e1 Chapter 8 Basic Administration Tasks.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
Unix Basics Chapter 4.
– Introduction to the Shell 10/1/2015 Introduction to the Shell – Session Introduction to the Shell – Session 2 · Permissions · Users.
Basic unix commands that everyone should know (Even if you have a mac) Slightly more advanced:
Title Slide CSS 404/504 The UNIX Operating System (2) By Ralph B. Bisland, Jr.
Linux+ Guide to Linux Certification, Second Edition
Introduction to Linux Azzam Mourad COEN 346.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
Using Commands Unix/IP Preparation Course July 19, 2009 Eugene, Oregon, USA
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
Using Commands Unix / Linux Preparation Course May 6, 2012 Serrekunda, The Gambia.
ITR3 lecture 6: intoduction to UNIX Thomas Krichel
File Security and Permissions. File Permissions (1) u With respect to a particular file, Unix divides the set of all users on a system into three categories:
Unix Commands PowerPoint Presentation developed for LS 560 Information Technology online class - University of Alabama by Debey Sklenar TENacious Cohort.
Chapter 4: File Security & Permissions Also: Hard and Soft Links, see p77-80 &
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
Introduction to Programming Using C An Introduction to Operating Systems.
Basic of UNIX For fresh members of SPARCS
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: which, passwd, date, ps / kill Working with Files: file, touch, cat, more, less, grep,
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
Linux Commands C151 Multi-User Operating Systems.
SCSC 455 Computer Security Chapter 3 User Security.
1 CS3695/M6-109 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
SUSE Linux Enterprise Desktop Administration Chapter 9 Manage Users, Groups, and Permissions.
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
1 Introduction to Unix. 2 What is UNIX?  UNIX is an Operating System (OS).  An operating system is a control program that helps the user communicate.
The Kernel At a high level, the kernel in an operating system serves as the bridge between applications and the actual data processing of the hardware.
1 CS3695 – Network Vulnerability Assessment & Risk Mitigation – Introduction to Unix & Linux.
BIF713 Introduction to Linux. Agenda Getting Started: Using Linux Unix and Linux - Structure / Features Elements of the Linux Philosophy Linux Command.
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
Login Being logged into a command line prompt allows a user to easily and simply execute multiple commands (one-by-one or at the same time) that would.
Using Linux Kaya Oğuz Room: 310.
Tutorial of Unix Command & shell scriptS 5027
CS3695/M6-109 – Network Vulnerability Assessment & Risk Mitigation –
Linux Command Basics I Tony Kombol.
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
C151 Multi-User Operating Systems
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands:
Tutorial of Unix Command & shell scriptS 5027
Basic UNIX OLC Training.
Introduction to UNIX.
Tutorial of Unix Command & shell scriptS 5027
Tutorial of Unix Command & shell scriptS 5027
Security and File Permission
UNIX/LINUX Commands Using BASH Copyright © 2017 – Curt Hill.
Working with Mac OS and Linux
CSE 303 Concepts and Tools for Software Development
Presentation transcript:

Tony Kombol

 man  on-line user manual  man command_you_want_info_on  type q to exit  examples:  for ls (list directory) ▪ man ls  for cp (copy) ▪ man cp

Switch user

 su userid  su is short for switch user ▪ temporarily assume the id of another user ▪ If no userid is supplied root is assumed ▪ Hence the term superuser is sometimes assumed for su ▪ Useful in cases when need to be root (superuser) for a small number of tasks ▪ or any user!

 It is often useful to become the superuser (root) to perform important system administration tasks  But as previously warned do not stay logged on as the root  Fortunately, there is a program to give temporary access another user's privileges:  su userid  If userid not specified, root is assumed

 To become the superuser or root  Debian:  Type the su command  CentOS:  Type the su – command  The – is important, in CentOS it gives the privilages  Then prompted for root's password: me]$ su Password: me]#  After executing the su command, a new shell session as the superuser is started  To exit the superuser session  type exit  Returns to previous session (user)

 An optional alternative way to allow one account to act as another account  Also allows restriction of use of features  Ubuntu  Installed in the base system  Disables root  Gives root authority to the base user through sudo  Example: sudo tkombol ifconfig

Permissions

 The Unix operating system families are not only multitasking but are also a multi-user  What exactly does multi-user this mean?  More than one user can be operating on the computer at the same time  While the computer might only have one keyboard and monitor, it can still be used by more than one user ▪ If the computer has serial ports users may access the computer via an external terminal ▪ If a computer is attached to a network, or the Internet, remote users can log in via telnet or ssh (secure shell) and operate the computertelnetssh

 To make multiple access practical, a method had to be devised to protect the users from each other  Actions of one user should not crash the computer  One user should not be able interfere with the files belonging to another user

 Unix and Linux use the same permissions scheme  Each file and directory is assigned access rights for: ▪ Owner of the file ▪ By default the userid that created the file ▪ Can be re-assigned ▪ Members of a group of related users ▪ By default the owner ▪ Everybody else ▪ e.g. the rest of the world  Rights can be assigned to: ▪ read a file (look at it) ▪ write a file (change it) ▪ execute a file (run the file as a program).

 To see the permission settings for a file use the ls command with the –l option: me]$ ls -l some_file  Typical response: -rwxrw-r-- 1 me us Sep 26 18:48 some_file

 By looking at the returned permissions -rwxrw-r-- 1 me us Sep 26 18:48 some_file a lot can be determined from examining the results of this command:  It is a normal file  Signified by the “-” on the left  The file " some_file " is owned by user "me" ▪ User "me" has the right to read, write & execute (run) this file  The file is owned by the group “us" ▪ Members of the group “us" can read and write this file  Everyone else can only read this file

 To interpret the first portion (10 characters) of the listing:  First character indicates the file type  - : normal file  d : directory  l : link  Followed by three sets of three characters ▪ Owner ▪ First three ▪ Group ▪ Second three ▪ Everybody else (world) ▪ Last three  Each set conveys permissions for ▪ Reading ▪ First character ▪ Writing ▪ Second character ▪ Execution ▪ Last character

 Change the file permissions (access):  chmod chmod ▪ modify file access rights  chown chown ▪ change file ownership  chgrp chgrp ▪ change a file's group ownership

 Change the permissions of a file or directory  Specify the desired permission settings and the file or files to be modified  Two ways to specify the permissions  Octal  Symbolic

 Permission settings can be thought of as a series of bits for each grouping  First bit for read  Second bit for write  Third bit for execute  Example:  rwx rwx rwx =  rw- rw- r-- =  rwx =  and so on...  Therefore for each group of 3 bits: ▪ rwx = 111 (binary) = 7 (octal) ▪ rw- = 110 (binary) = 6 (octal) ▪ r-x = 101 (binary) = 5 (octal) ▪ r-- = 100 (binary) = 4 (octal) ▪ Etc.  Octal is perfect for noting permissions!

By representing each of the three sets of permissions (owner, group, and other) as a single octal digit Convenient way of expressing the permissions Example: set some_file to have read and write permission for the owner, but keep the file private from others, enter the command: – me]$ chmod 600 some_file

 chmod command can also be used to control the access permissions for directories  Permissions scheme for directories similar to files ▪ R – view directory contents ▪ W - create or delete files in the directory ▪ X – Allow users to change into directory (cd dir)

 chmod [ugoa][+-=][rwx] fname  The first symbol is the reference (who) to change: ▪ u: user (owner) ▪ g: group ▪ o: others (world) ▪ a: all the above ▪ Multiple references may be specified…  The second symbol is to add, remove or set a permission ▪ +: add the permission ▪ -: remove the permission ▪ =: make it the exact permission  The last symbol is the permission to change ▪ r: is to read ▪ w: is to write ▪ x: is to execute ▪ Multiple permissions may be specified

 Examples:  chmod u+w change.sh ▪ Add the ability of the owner (user) to edit (w) change.sh ▪ Really to save it after it is changed ▪ Does not change any other permissions  chmod a-x xyz.sh ▪ Remove execute for everyone (all)

 Octal:  Can set all permissions with 3 digits  Easiest to change all permissions to an exact specification  Symbolic:  Can easily alter only one permission  Know and use both effectively!

 Change the owner of a file  File creator is the original owner by default  Only root can chown  Example: Change the owner of some_file from "me" to "you”:  me]$ su Password: me]# chown you some_file me]# exit me]$

 Remember: in order to change the owner of a file, you must have root authority!  To do this, our example: ▪ employed the su command for a root shell ▪ executed chown ▪ exited to return to original shell  chown works the same way on directories as it does on files

 Change the group ownership of a file or directory  Command format:  me]$ chgrp new_group some_file  In the example above  Group ownership of some_file changed from its previous group to "new_group"  Must be the owner of the file or directory to perform a chgrp

 Several commands available to control processes  The most commonly used:  kill kill ▪ sends a signal to one or more processes ▪ usually to "kill" a process

 Suppose a program becomes unresponsive  How to get rid of it?  Use the kill command  Let's try this out on xload: ▪ First, identify the process to kill ▪ Use either jobs or ps to do this ▪ jobs will return a job number ▪ ps returns a process id (PID).

 me]$ xload & [1] 1292  me]$ jobs [1]+ Running xload &  me]$ kill %1  me]$ xload & [2] 1293 [1] Terminated xload  me]$ ps PID TTY TIME CMD 1280 pts/5 00:00:00 bash 1293 pts/5 00:00:00 xload 1294 pts/5 00:00:00 ps  me]$ kill 1293 [2]+ Terminated xload Start xload and return control to terminal Use jobs to see who is running  [1] is the id number Kill id 1 Start xload again Use p to see the procsss status  1293 is xloads process id Kill process1293

 Flexible and powerful text search utility  Basic syntax:  grep search-item file_searched  Can get very sophisticated   can use regular expressions  can search multiple files

 “>”  Output of a program goes to std out by default ▪ Usually the monitor or terminal  > sends the output to a file instead ▪ Creates the file if it does not exist ▪ Replaces the file contents if it does exist  “>>” ▪ Appends data to an existing file  “<“  Data is read from std in ▪ Usually the keyboard or terminal  Reads the input from a different source (file)

 “|”  Takes the output of one program and uses it as input to another  E.g.: ▪ du | less

 Autocomplete  Tab key ▪ Start the command or name ▪ Hit Tab ▪ If what you typed is unique up to that point bash will complete the rest of the typing! ▪ If what you typed is not unique it will give a gentle beep ▪ Hit Tab again to get a list of matches  Recall  The up arrow will recall previous commands  The down arrow recalls later commands

 When commands are entered on the terminal they are kept in the history library  List your top 10 by with the history command:  History by itself gives the last ~500 commands  Use pipes and filters to get the reduced data history | awk '{print $2}' | awk 'BEGIN {FS="|"}{print $1}' | sort | uniq -c | sort -n | tail | sort -nr

More Top Linux Commands for Newbie hostname Prints the name of the local host that you are currently working on. Use netconf to change the name of the machine. whoami Prints current user on the screen. Extremely when switching between a user ids. finger user_id System info about a user. Try: finger root df –h Print disk info about all the file systems. The - h means in human-readable form. (df=disk free) grep Search for certain phrases or words in a file du / -bh | more Print detailed disk usage for each subdirectory starting at the “/” (root) directory in human legible form. (du=disk usage) free Memory info (in kilobytes) pwd Show the name of the current working directory