Linux 201 Training Module Linux Adv File Mgmt.

Slides:



Advertisements
Similar presentations
UNIX Chapter 12 Redirection and Piping Mr. Mohammad Smirat.
Advertisements

EMT 2390L Lecture 4 Dr. Reyes Reference: The Linux Command Line, W.E. Shotts.
1 CSE 390a Lecture 2 Exploring Shell Commands, Streams, and Redirection slides created by Marty Stepp, modified by Josh Goodwin
Linux+ Guide to Linux Certification, Second Edition
Guide To UNIX Using Linux Third Edition
T UTORIAL OF U NIX C OMMAND & SHELL SCRIPT S 5027 Professor: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2015.
Lecture 02CS311 – Operating Systems 1 1 CS311 – Lecture 02 Outline UNIX/Linux features – Redirection – pipes – Terminating a command – Running program.
Grep, comm, and uniq. The grep Command The grep command allows a user to search for specific text inside a file. The grep command will find all occurrences.
Linux File Security. What is Permission ? Specifies what right are granting to users to access the resources available in the computer. So that important.
Unix Filters Text processing utilities. Filters Filter commands – Unix commands that serve dual purposes: –standalone –used with other commands and pipes.
UNIX Filters.
Linux Commands LINUX COMMANDS.
Advanced File Processing
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
– Introduction to the Shell 10/1/2015 Introduction to the Shell – Session Introduction to the Shell – Session 2 · Permissions · Users.
File Permissions. What are the three categories of users that apply to file permissions? Owner (or user) Group All others (public, world, others)
Linux+ Guide to Linux Certification, Second Edition
Jozef Goetz, expanded by Jozef Goetz, 2009 Credits: Parts of the slides are based on slides created by UNIX textbook authors, Syed M. Sarwar, Robert.
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
Additional UNIX Commands. 222 Lecture Overview  Multiple commands and job control  More useful UNIX utilities.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
Advanced File Processing. 2 Objectives Use the pipe operator to redirect the output of one command to another command Use the grep command to search for.
Chapter Five Advanced File Processing Guide To UNIX Using Linux Fourth Edition Chapter 5 Unix (34 slides)1 CTEC 110.
Chapter Five Advanced File Processing. 2 Objectives Use the pipe operator to redirect the output of one command to another command Use the grep command.
Module 6 – Redirections, Pipes and Power Tools.. STDin 0 STDout 1 STDerr 2 Redirections.
I/O and Redirection. Standard I/O u Standard Output (stdout) –default place to which programs write u Standard Input (stdin) –default place from which.
Linux file system "On a UNIX system, everything is a file; if something is not a file, it is a process." Sorts of files (on a Linux system) Directories:
Chapter Five Advanced File Processing. 2 Lesson A Selecting, Manipulating, and Formatting Information.
Searching and Sorting. Why Use Data Files? There are many cases where the input to the program may come from a data file.Using data files in your programs.
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
A Brief Overview of Unix Brandon Bohrer. Topics What is Unix? – Quick introduction Documentation – Where to get it, how to use it Text Editors – Know.
1 CSE 390a Lecture 2 Exploring Shell Commands, Streams, and Redirection slides created by Marty Stepp, modified by Jessica Miller & Ruth Anderson
CS 403: Programming Languages Lecture 20 Fall 2003 Department of Computer Science University of Alabama Joel Jones.
File Management commands cat Cat command cat cal.txt cat command displays the contents of a file here cal.txt on screen (or standard out).
Exploring Shell Commands, Streams, and Redirection
Tutorial of Unix Command & shell scriptS 5027
Lesson 5-Exploring Utilities
Chapter 11 Command-Line Master Class
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Linux file system "On a UNIX system, everything is a file;
Some Linux Commands.
Chapter 6 Filters.
Exploring Shell Commands, Streams, and Redirection
INTRODUCTION TO UNIX: The Shell Command Interface
Exploring Shell Commands, Streams, and Redirection
Tutorial of Unix Command & shell scriptS 5027
Basic UNIX OLC Training.
Tutorial of Unix Commands
Tutorial of Unix Command & shell scriptS 5027
CSE 390a Lecture 2 Exploring Shell Commands, Streams, and Redirection
The Linux Command Line Chapter 6
Guide To UNIX Using Linux Third Edition
Tutorial of Unix Command & shell scriptS 5027
Exploring Shell Commands, Streams, and Redirection
Exploring Shell Commands, Streams, and Redirection
Exploring Shell Commands, Streams, and Redirection
UNIX Reference Sheets CSE 2031 Fall 2010.
More advanced BASH usage
CSE 390a Lecture 2 Exploring Shell Commands, Streams, and Redirection
Linux Shell Script Programming
Linux Commands LINUX COMMANDS.
Exploring Shell Commands, Streams, and Redirection
CSC 4630 Meeting 4 January 29, 2007.
Exploring Shell Commands, Streams, and Redirection
A shell is a user interface.
Exploring Shell Commands, Streams, and Redirection
Exploring Shell Commands, Streams, and Redirection
Presentation transcript:

Linux 201 Training Module Linux Adv File Mgmt

This presentation will cover the following topics PATH Concept ln which cut sort, uniq diff find grep options Redirection >, | , tee chown, chgrp

PATH PATH is an environmental variable in Linux that tells the shell which directories search for executable files in response to commands issued by a user. $] echo $PATH /opt/apache-maven- 3.0.4/bin:/home/netstorm/work/bin:/home/n etstorm/work/tools:/bin:/apps/java/jdk1.6.0_ 24/bin:/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr /local/bin:/opt/cavisson/monitors/bin:/usr/lib 64/qt- 3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local /sbin:

ln command To make a symbolic link : ln /original/file /new/link This makes /original/file and /new/link the same file - edit one and the other will change. The file will not be gone until both /original/file and /new/link are deleted. To make a soft symbolic link : ln -s /original/file /new/link

which command Locate a command shows the full path of commands. $ which cat /bin/cat

cut command Cut out selected fields of each line of a file. name=`who am i | cut -f1 -d' '` Set name to current login name.

sort command sort lines of text files Sort a file in ascending order $ sort names.txt Sort a file in descending order $ sort -r names.txt

Uniq comand remove duplicate lines from a sorted file sort myfile | uniq eliminates duplicate lines from the stream (the symbol "|" pipes the output from sort myfile to the uniq command).

diff command diff - find differences between two files $]diff from-file to-file

find command find - search for files in a directory hierarchy find / -name game Looks for a file named "game" starting at the root directory  find /usr -name *stat Find every file under the directory /usr ending in "stat".

Grep Options Search for a string in a file grep "Error" logfile.txt Case insensitive search grep -i "UNix" file.txt Specifying the search string as a regular expression pattern. grep "^[0-9].*" file.txt This will search for the lines which starts with a number.

Checking for the whole words in a file. grep -w "world" file.txt The -w option to grep makes it match only the whole words. Searching for a sting in all files recursively grep -r "string" * Displaying the count of number of matches. grep -c "sting" file.txt

redirection By default, standard output directs its contents to the display. To redirect standard output to a file, the ">" character is used like this: [me@linuxbox me]$ ls > file_list.txt

Pipes With pipes, the standard output of one command is fed into the standard input of another. E.g [me@linuxbox me]$ ls -l | less

Tee command Read from an input and write to a standard output and file. ls *.txt | wc -l | tee /dev/tty count.txt In the above example the ls command would list all .txt files in the current directory, take a word count (wc) by the amount of lines (-l) and the output displayed to the /dev/tty (terminal) will be sent to the count.txt.

chown & chgrp command To change the owner of a file/directory, use the chown command $ chown newowner file/dir To change the group of a file/directory, use the chgrp command. $ chgrp newgroup file/dir Both chown and chgrp support the -r option for recursively changing the owner or group of an entire subdirectory