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).

Slides:



Advertisements
Similar presentations
RH030 Linux Computing Essentials
Advertisements

Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
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.
Working with Files How to create, view, copy, rename and print files.
Lab6 CPCS361 I.Mona Alshehri. Working with Files and Directories Creating files Create a file with the cat command type the command cat > name_of_file.
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Jan. 27 th, 2009 Essential Unix Commands.
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.
Linux+ Guide to Linux Certification, Second Edition
Linux Files. Files and directories As in Windows directories are structures which contain –Other directories –Files.
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 01CS311 – Operating Systems 1 1 CS311 – Lecture 01 Outline Course introduction Setting up your system Logging onto the servers at OSU with ssh.
L INUX C OMMAND L INE I NTERFACE G UNAANBAN.G
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Learning basic Unix command IT 325 operating system.
"Two of the most famous products of Berkeley are LSD and Unix. I don't think that this is a coincidence.” Anonymous.
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”
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
CHAPTER 1 UNIX FOR NONPROGRAMMERS By U ğ ur Halıcı.
Linux Directory Navigation. File & Directory Commands This is a minimal list of Unix commands that you must know for file management: ls (list) mkdir.
Working with Files Chapter 5. Display a Calendar Display a calendar for a specific month – cal Display a calendar for a specific year – cal 2000.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
1 Lecture 2 Working with Files and Directories COP 3344 Introduction to UNIX.
Chapter Four UNIX File Processing. 2 Lesson A Extracting Information from Files.
Guide To UNIX Using Linux Fourth Edition
Basic unix commands that everyone should know (Even if you have a mac) Slightly more advanced:
Linux+ Guide to Linux Certification, Second Edition
System Administration Introduction to Unix Session 2 – Fri 02 Nov 2007 Reference:  chapter 1, The Unix Programming Environment, Kernighan & Pike, ISBN.
INTRODUCTION TO LINUX Jacob Chan. GNU/Linux Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix –Multi-user.
Lesson 2-Touring Essential Programs. Overview Development of UNIX and Linux. Commands to execute utilities. Communicating instructions to the shell. Navigating.
Second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands cal – will print a calendar.
BIF713 Basic Unix/Linux Commands Getting Help with Commands.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands: whereis, which, whoami, finger, passwd, cal, date Working with Files: cat, more, less.
1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi.
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
Λειτουργικά Συστήματα – Lab2 Γιάννης Πετράκης. Directory Navigation and Control  The Unix file system is set up like a tree branching out from the root.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2a – A Unix Command Sampler (Courtesy of David Notkin, CSE 303)
Linux Commands C151 Multi-User Operating Systems.
2 Manual & Filestore Mauro Jaskelioff. Introduction Using the manual The UNIX filestore File permissions.
1 Lecture 2 Working with Files and Directories COP 3353 Introduction to UNIX.
Linux Stuff Last Update Copyright 2014 Kenneth M. Chipps Ph.D. 1.
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.
CSCI 330 UNIX and Network Programming Unit II Basic UNIX Usage: File System.
Unix Fundamentals CS 127. File navigation cd - change directory cd /var/log cd /etc/apache2 cd ~/Desktop ~ is a shortcut for the home directory.
Basic Unix Commands. Listing files and directories ● ls:command is used to list the files and ● directories in present working directory ● ls command.
Learning basic Unix command It 325 operating system.
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.
Learning Unix/Linux Based on slides from: Eric Bishop.
1 Linux Commands. 2 Path You specify a file or directory by its path name:  the full, or absolute, path name or the one relative to a location. The full.
UNIX To do work for the class, you will be using the Unix operating system. Once connected to the system, you will be presented with a login screen. Once.
Tutorial of Unix Command & shell scriptS 5027
Commands Basic syntax of shell commands UNIX or shell commands have a basic structure command -options target command comes first (such as cd or ls) any.
Prepared by: Eng. Maryam Adel Abdel-Hady
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
Lecture 2 Working with Files and Directories
Some Linux Commands.
Agenda Basic Unix Commands (Chapters 2 & 3) Miscellaneous Commands:
Tutorial of Unix Command & shell scriptS 5027
Tutorial of Unix Command & shell scriptS 5027
Introduction to Linux Week 0 - Thursday.
Operating Systems and Using Linux
Tutorial of Unix Command & shell scriptS 5027
Chapter Four UNIX File Processing.
Tutorial Unix Command & Makefile CIS 5027
Module 6 Working with Files and Directories
Lab 2: Terminal Basics.
January 26th, 2004 Class Meeting 2
Presentation transcript:

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).

Cat > filename Cat command cat > cal.txt cat output the contents to a file here cal.txt. It is redirecting the contents to the file. touch filename

ls ls command is most widely used command and it displays the contents of directory. options ls will list all the files in your home directory, this command has many options. ls -l will list all the file names, permissions, group, etc in long format. ls -a will list all the files including hidden files that start with.. ls -lt will list all files names based on the time of creation, newer files bring first. ls -Fxwill list files and directory names will be followed by slash. ls -Rwill lists all the files and files in the all the directories, recursively. ls -R | more will list all the files and files in all the directories, one page at a time.

ls -rw-r--r-- 1 lnp5jb 777 Dec 18 lookup.icn The first set of characters in the output from the command (-rw- r-- r--) gives the permissions. The username in the middle of the line (lnp5jb) is the owner of the file. This is user who created the file. The following fields tell you the number of characters in the file, the date it was created and the name of the file.

mkdir mkdir deep will create new directory, i.e. here deep directory is created.

cd Cd command. cd sandeep will change directory from current directory to sandeep directory. Use pwd to check your current directory and ls to see if sandeep directory is there or not. You can then use cd sandeep to change the directory to this new directory.

head head filename by default will display the first 10 lines of a file. If you want first 50 lines you can use head -50 filename or for 37 lines head -37 filename and so forth.

tail Tail command. tail filename by default will display the last 10 lines of a file. If you want last 50 lines then you can use tail -50 filename.

more More command. more command will display a page at a time and then wait for input which is spacebar. For example if you have a file which is 500 lines and you want to read it all. So you can use more filename

wc Wc command wc command counts the characters, words or lines in a file depending upon the option. wc filename wc -l filename will print total number of lines in a file. wc -w filename will print total number of words in a file. wc -c filename will print total number of characters in a file.

File command displays about the contents of a given file, whether it is a text (Ascii) or binary file. To use it type file filename

cp Cp command. cp command copies a file. If I want to copy a file named oldfile in a current directory to a file named newfile in a current directory. cp oldfile newfile cp –p olddir nerdir If I want to copy oldfile to other directory for example /tmp then cp oldfile /tmp/newfile. options available with cp are -p and -r. -p options preserves the modification time and permissions, -r recursively copy a directory and its files, duplicating the tree structure.

mv mv command is used to move a file from one directory to another directory or to rename a file. Some examples: mv oldfile newfile will rename oldfile to newfile. mv -i oldfile newfile for confirmation prompt. mv -f oldfile newfile will force the rename even if target file exists. mv * /usr/bajwa/ will move all the files in current directory to /usr/bajwa directory.

ln Ln command. Instead of copying you can also make links to existing files using ln command. If you want to create a link to a file called coolfile in /usr/local/bin directory then you can enter this command. ln mycoolfile /usr/local/bin/coolfile Some examples: ln -s fileone filetwo will create a symbolic link and can exist across machines. ln -n option will not overwrite existing files. ln -f will force the link to occur.

rm Rm command. To delete files use rm command. Options: rm oldfile will delete file named oldfile. rm -f option will remove write-protected files without prompting. rm -r option will delete the entire directory as well as all the subdirectories, (use with care)

rmdir Rmdir command. rmdir command will remove directory or directories if a directory is empty. Options: rm -r directory_name will remove all files even if directory is not empty. rmdir sandeep is how you use it to remove sandeep directory. rmdir -p will remove directories and any parent directories that are empty. rmdir -s will suppress standard error messages caused by - p.

Misc Commands

Man ual command. man man This is help command, and will explains you about online manual pages you can also use man in conjunction with any command to learn more about that command for example. man ls will explain about the ls command and how you can use it.

banner Banner command. banner prints characters in a sort of ascii art poster. banner aman will print aman on screen

cal Cal command cal command will print the calander on current month by default. If you want to print calander of august of That's eightht month of cal will print following results.

clear Clear command clear command clears the screen and puts cursor at beginning of first line.

echo echo command The echo command 'echoes' its argument to the standard output. This means that in its simplest form it prints something out on screen. For example: echo Hello - you type Hello - response from the shell

wildcards Wildcards Wildcard characters can be used to identify directory and file names. The wildcard character * is used to refer to any combination of characters. For example: ls * - refers to all files cat test* - refers to all files starting with 'test', e.g. 'test', 'testing', 'test.c', etc. The wildcard character ? is used to refer to a single character. For example: ls test? - refers to files starting with 'test' followed by a single character e.g. 'test1', 'test2', 'testz', etc.% cat test.? - refers to all files starting with 'test' with a single character after the full stop, e.g. 'test.c, test.f'

chmod The command chmod is used to change the permissions on a file. The format of this command is: chmod mode filename