3-UNIX-Commands

3-UNIX-Commands - COMMON UNIX COMMANDS Common UNIX Commands...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: COMMON UNIX COMMANDS Common UNIX Commands • There are many UNIX commands that can be very useful • They output of one can be connected to the input of the other using PIPES • They are part of the UNIX distribution. • Open source impementations exist and they are available in Linux. ls – list files and directories • ls <options> file list • Examples ls –al - Lists all files including hidden files (files that start with “ . ” ) and timestamps. ls –R dir - Lists recursively all directories and subdirectories in dir. mkdir – Make a directory • mkdir <options> dir1 … • Examples mkdir dir1 Create directory dir1 mkdir –p dir1/dir2/dir3 Make parent directory an subdirectories if it they do not exist. cp – Copy files • cp <options> file1 file2 … destdir Copies one or more files to a destination. • Examples: cp a.txt dir1 Copies file a.txt into dir1 cp a.txt b.txt Create a copy of a.txt called b.txt cp –R dir1 dir2 Copy recursively directories and subdirectories of dir1 into dir2. mv – Move a file • mv file1 destdir Moves file1 to destdir • Examples: mv a.txt dir1 Move file a.txt into directory dir1 mv a.txt b.txt Rename file a.txt into b.txt rm – Remove a file • rm <options> file1 file2 … Removes a list of files • Examples: rm a.txt b.txt Remove files a.txt and b.txt rm –f a.txt Remove a.txt. Do not print error message if fails. rm –R dir1 Remove dir1 and all its contents. grep – Find lines • grep <options> pattern file1 file2 … • Print lines that contain “ pattern ” • Examples: grep hello a.txt Print the lines in a.txt that contain hello grep hello * */* */*/* Print the lines that contain hello in any file in the directory and subdirectories. man – Print manual pages • man <options> command • Print the manual page related to command. Print the manual page related to command....
View Full Document

Page1 / 26

3-UNIX-Commands - COMMON UNIX COMMANDS Common UNIX Commands...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online