Download presentation
Presentation is loading. Please wait.
Published byProsper Washington Modified over 8 years ago
1
Basic Unix Commands
2
Listing files and directories ● ls:command is used to list the files and ● directories in present working directory ● ls command is most used command ● syntax: ls Lists the files and directories in present working directory
3
ls ● Display One File Per Line Using ls -a ● To show hidden files ● means. Files in unix
4
ls ● Display All Information About Files/Directories Using ls -l ● To show long listing information about the file/directory. ● $ ls -l ● -rw-r----- 1 srinivas team-dev 9275204 Jun 13 15:27 mthesaur.txt.gz ● 1st Character – File Type: ● - normal file ● d directory
5
ls ● Field 1 – File Permissions ● Field 2 – Number of links ● Field 3 – Owner ● Field 4 – Group ● Field 5 – Size ● Field 6 – Last modified date & time ● Field 7 – File name
6
Display File Size in Human Readable Format Using ls -lh ● Use ls -lh (h stands for human readable form), to display file size in easy to read format. i.e M for MB, K for KB, G for GB. ● $ ls -lh ● -rw-r----- 1 srinivas team-dev 8.9M Jun 12 15:27 arch- linux.txt.gz
7
cd ● cd command is used to change the directories ● options: cd. Current directory ● cd.. back to one directory ● cd../../ go back two directories.
8
Pathnames ● Use the pwd command to print the working directory (the current directory you are in) ● $ pwd ● /home ● $ cd /home/rich/www ● $ pwd ● /home/rich/www ● $
9
Creating Directories ● mkdir : command is used to create directories ● The syntax for the mkdir command is: ● mkdir directoryname
10
Copying Files ● cp: command is used to copy files one one directory to another directory ● syntax : cp source destination
11
Moving Files ● The mv command is used to move a file from one directory to another directory ● we can also use this command to renaming a file ● Syntax: mv fromsource todestination ● mv a.txt b.txt ● The above command changes file name “a to b”
12
Removing Files and directories ● rm : this command is used to remove files and directories ● syntax: rm [option] file/directory ● the -rf option can be used to remove the directories and sub directories. ● rm -rf directoryname
13
Displaying the contents of a file on the screen ● In unix we have multiple commands to display the content of a file on the screen some of them are ● 1.more ● 2.cat ● 3.vi editor
14
more ● The more command displays the content of a file on the screen ● syntax: more filename ● We can't modify the content of a file using more command this is used just for display file content only
15
cat command Using cat command we can read and modify the content of a file. We can use this command to concatenate files 1.reading a file syntax:cat filename 2.appending text to a file syntax: cat >> filename 3.Over writing file content syntax: cat > filename
16
Questions???
17
Thank You
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.