Manage Files Using CLI - RHCSA (RH124).pdf

support8872 3,274 views 12 slides Sep 19, 2024
Slide 1
Slide 1 of 12
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

About This Presentation

Slides on how to manage files using CLI - Part of RHCSA (RH124) syllabus


Slide Content

Manage Files Using CLI

File System
Method and data structure used by Operating System to control
how data is stored and retrieved on storage devices

Regular File: Data in a human-readable or binary
format, identifiable by a unique name.


Directory Files: File that serves as a container to
organize and store other files and directories.
Also identifiable by a unique name.


Special Files: To interact with hardware devices
and provide access to system resources. E.g.:
○Named Pipe File
○Symbolic Link File (l)

Files and Directories

Create a regular file and list the files & directories using ls command
●Command: touch <file_name>



Creating multiple files
●Command: touch <file_name_1> <file_name_2>


Handling Files

Create a directory file
●Command: mkdir <directory_name>




Creating multiple directory files
●Command: mkdir <directory_name_1> <directory_name_2>

Delete a regular file
●Command: rm <file_name>




Delete a directory file
●Command: rmdir <director_name>

Copy files or directories
●cp: cp [options] source destination (-v is verbose mode)





Move files or directories.
●mv: mv [options] source destination

●Pointers or references to files or directories.

●Each file in linux is represented by inode (index node)

●Inode: Contains pointer to actual data blocks of file on hard disk.
Links

●Types:
○Hard Links
■Command: ln source_file hard_link_name




○Soft Links
■Command: ln -s source_file soft_link_name

●stdout, stdin and stderr are the default streams used in Linux.
●Standard Output (stdout):
○By default send output to terminal
○Manipulate the output to a file using:
■‘>’ overwrite the file
■‘>>’ append to a file
●Standard Input (stdin):
○By default takes input from keyboard.
○‘<’ to take input from a file.
●Standard Error (stderr):
○Route errors to a file instead of terminal.
○‘2>’ append errors to a log file.
I/O Redirects

Pipe (|)
●Used to send output of one command as input to the next
command.
●Example:
○ls | grep ‘coder’