Linux file commands

sundasShabbir 207 views 17 slides Jan 08, 2018
Slide 1
Slide 1 of 17
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17

About This Presentation

Linux file commands


Slide Content

Linux Basic Commands File Commands Instructor: Sundas Ahmed By: Mam Sundas Ahmed 1

File Command… file – This command is used to determine a file’s file type. Synatx : $ file file-name By: Mam Sundas Ahmed 2

Remove File Command… rm – To remove file or directory. Syntax: $ rm file-name $ rm -r dir -name Options: $ rm -f (To remove a file forcefully ) $ rm -r (To remove a directory) $ rm - rf (To remove a directory forcefully). By: Mam Sundas Ahmed 3

Move Command… mv – To move file or directory from one location to another location. – Also used to rename file and directory. Syntax: $ mv file-name /location $ mv old-name new-name By: Mam Sundas Ahmed 4

Cat Command… cat – To view contents of file. – Also used to create new text file. Syntax: $ cat file-name (To view the file contents) $ cat > file-name (To create a text file) $ cat >> file-name (To append the text existing file) $ ctrl+d (To save contents of the file) Options: $ cat -n (to view contents of file with line numbers). By: Mam Sundas Ahmed 5

Copy Command… cp – Use to copy the files and directories. Syntax: $ cp file1 file2 $ cp -f file1 file2 (to copy file forcefully) $ cp -r dir1 dir2 (to copy directory recursively) By: Mam Sundas Ahmed 6

Kernel Name other informtion uname – Use to show the kernel name and other information. Syntax: $ uname Options: $ uname -o (to show OS name). $ Uname -r (to show kernel version). $ Uname -v (to show kernel release). $ uname -n (to show hostname). By: Mam Sundas Ahmed 7

Echo Printing Command… echo – To print the string on the screen. – Also used to create file or Pr ints a tex t on th e standar d outpu t However in an int e ractive sc r ipt, me ssag e t o th e use r throug h term i nal . Syntax: $ echo string to print $ echo string to save > file-name $ echo string to append >> file-name Options: $ - By: Mam Sundas Ahmed 8

which • To locate the path of command or program or It is u s e d t o locat e exe c utable s i n th e s y ste m. It allows user to pass several command arguments to get their paths in the system. • Syntax which command which cp E x am p l e : w h ich ls By: Mam Sundas Ahmed 9

• cal • To display calendar. It is u s ed t o di s pla y cal e ndar of th e prese nt mo nt h or any oth e r mont h . • Syntax cal Ex a mpl e : 3 1991 • Options • cal -y (to show the complete calendar) • cal -m (calendar start from Monday) • cal -j (to show Julian calendar) • cal -3 (to show previous, current and next month calendar) By: Mam Sundas Ahmed 10

• wc • Print byte, word, and line counts. • Syntax wc file-name • Options • wc -c (to count characters of file) • wc -w (to count words of f By: Mam Sundas Ahmed 11

• who • Print information about users who are currently logged in • Syntax who • Options • who -H (out put with heading) • who -b (to show boot time) • who -r (to show current runlevel ) By: Mam Sundas Ahmed 12

whoami • Show current logged on user on terminal. • Syntax whoami more • To display the contents of a file from top to bottom. • Syntax more file- nam By: Mam Sundas Ahmed 13

Navigation Keys Enter key • Use to page down line by line Space key • Use to page down page by page By: Mam Sundas Ahmed 14

• man • A command use to view manual or help of linux commands. • Syntax man command man cp • q (press “q” key to exit from manual) • halt To shut down the system. • poweroff To shut down the system. • reboot To re-start the system. By: Mam Sundas Ahmed 15

• date • To display and change the date and time. • Syntax date • Options date -s “MM/DD/YYYY hh:mm:ss ” date -s “DD month YYYY hh:mm:ss ” date -s “YYYY-MM-DD hh:mm:ss ” date -s “YYYYMMDD hh:mm:ss ” • Date format date +%T or +%X (Time) date +%a or +%A (Day) date +%D or +%F or +%x (Date) date +%b or +%B or +%m (Month) date +%G (Year) By: Mam Sundas Ahmed 16

The End  By: Mam Sundas Ahmed 17