SlideShare ist ein Scribd-Unternehmen logo
1 von 36
PSG COLLEGE OF TECHNOLOGY
20MX15 - UNIX ARCHITECTURE AND PROGRAMMING
By
21MX124 - Sandhiya M.
21MX207 - Karpaga Prasanth K.
21MX210 - Maheash Kumar M.
21MX213 - Om Raju V.
Ms. A. Kalyani
Asst.Professor MCA (PSG)
The ‘cd’ Command
The ‘cd’ Command is used to change the current
directory to another directory.
Syntax: cd [directory path]
The ‘bc’ Command
• bc command is used for command line calculator. It is similar to basic calculator
by using which we can do basic mathematical calculations.
Arithmetic operations are the most basic in any kind of programming language.
Linux or Unix operating system provides the bc command and expr
command for doing arithmetic calculations. You can use these commands in bash
or shell script also for evaluating arithmetic expressions.
Syntax:
Bs [-hlwsqv] [more options] [file…]
bc - Supports
• Arithmetic operators.
• Increment or Decrement operators.
• Assignment operators.
• Comparison or Relational operators.
• Logical or Boolean operators.
• Math functions.
• Conditional statements.
• Iterative statements.
The ‘man’ Command
• Man command in Linux is used to display the user manual of any command that we
can run on the terminal. provides a detailed view of the command which
includes NAME, SYNOPSIS, DESCRIPTION, OPTIONS, EXIT STATUS,
RETURN VALUES, ERRORS, FILES, VERSIONS, EXAMPLES,
AUTHORS and SEE ALSO.
Syntax:
$man [options] [command name]
The ‘who’ Command
• The Linux "who" command lets you display
the users currently logged in to your UNIX or
Linux operating system. Whenever a user
needs to know about how many users are using
or are logged-in into a particular Linux-based
operating system, he/she can use the "who"
command to get that information.
The ‘whoami’
Command
• It displays the username of the current user
when this command is invoked.
• Displays user, group and privileges
information for the user who is currently
logged on to the local system. If used without
parameters, whoami displays the current domain
and user name.
The ‘pwd’ Command
• pwd stands for Print Working Directory. It prints the path of the working directory,
starting from the root. pwd is shell built-in command(pwd).
• Options:
pwd -l : Prints the symbolic path.
pwd –p : Prints the Actual path.
The ‘mkdir’ Command
• Mkdir stands for make directory .
• The “mkdir” command is used to create a directory.
• -p: option create a hierarchy of directories.
Syntax: mkdir [directory path]
ubuntu@ubuntu-VirtualBox:~$ mkdir folder
ubuntu@ubuntu-VirtualBox:~$ mkdir folder1
ubuntu@ubuntu-VirtualBox:~$ mkdir -p folder1/subfolder/anotherfolder
The ‘rmdir’
Command
Rmdir stands for remove directory.
The “rmdir” command is used to remove
directory.
• Syntax: rmdir [directory path]
• ubuntu@ubuntu-VirtualBox:~$ rmdir folder
The ‘ls’
Command
The Linux ls command allows you to view a
list of the files and folders in a given
directory. You can also use this command to
display details of a file, such as the owner of
the file and the permissions assigned to the
file.
• ubuntu@ubuntu-VirtualBox:~$ ls
• 21mx124_practice_commands Documents Music
samplefile Videos
• 21mx124_practice_commands_2 Downloads Pictures
samplefile1
• Desktop folder1 Public Templates
THE ‘LS’
COMMAND
OPTIONS
The ‘Touch’
Command
The touch command is a standard command used in
UNIX/Linux operating system which is used to create,
change and modify timestamps of a file.
• Syntax: Touch [File_name]
• ubuntu@ubuntu-VirtualBox:~$ touch samplefile
• ubuntu@ubuntu-VirtualBox:~$ touch samplefile1
• ubuntu@ubuntu-VirtualBox:~$ ls
• 21mx124_practice_commands Documents Music samplefile
Videos
• 21mx124_practice_commands_2 Downloads Pictures
samplefile1
• Desktop folder1 Public Templates
The ‘mv’ Command
mv stands for move. mv is used to move one
or more files or directories from one place to
another in a file system like UNIX. It has two
distinct functions.
• It renames a file or folder.
• It moves a group of files to a different
directory.
The ‘date’ Command
• Date command is used to display the system date and time. It is also used
to set date and time of the system.
• By default the date command displays the date in the time zone on which
unix operating system is configured.
• You must be the super-user to change the date and time.
Syntax:
$date
The ‘cat’ Command
Cat command stands for concatenate. It reads data from the file and gives their
content as output. It helps us to create, view, and concatenate files.
Frequently used cat commands:
• To view a single file .
Command:
$cat filename
• To view multiple files
Command:
$cat file1 file2
• Create a file
Command:
$ cat >newfile
• Copy the contents of one file to another file.
Command:
$cat [filename-whose-contents-is-to-be-copied] > [destination-filename]
The ‘More’ Command
• more command is used to view the text files in the command prompt, displaying
one screen at a time in case the file is large.
• The more command also allows the user do scroll up and down through the page.
• When the output is large, we can use more command to see output one by one.
• Another application of more is to use it with some other command after a pipe.
Syntax:
The syntax along with options and command is as follows.
more [-options] [-num] [+/pattern] [+linenum] [file_name]
[-options]: any option that you want to use in order to change the way the file is
displayed.
(-d, -l, -f, -p, -c, -s, -u)
[-num]: type the number of lines that you want to display.
[+/pattern]: replace the pattern with any string that you want to find in the text file.
[+linenum]: use the line number from where you want to start displaying the text
content.
[file_name]: name of the file containing the text that you want to display on the
screen.
The ‘less’ Command
• Less command is used to read the contents of a file one page at a time.
• It has faster access because if file is large it doesn’t access the complete file, but
accesses it page by page.
• For example, if it’s a large file and you are reading it using any text editor, then
the complete file will be loaded to main memory. The less command doesn’t load
the entire file, but loads it part by part which makes it faster.
Syntax :
less filename
The ‘print’ Command
• printf command is used to display the given string, number or any other format specifier on the
terminal.
• It works the same way as “printf” works in programming languages like C.
Syntax:
$printf [-v var] format [arguments]
The most commonly used printf specifiers are %s, %b, %d, %x and %f.
1) %s : It is basically a string specifier for string output. $printf "%sn" "Hello, World!"
2) %b : It is same as string specifier but it allows us to interpret escape sequences with an argument.
printf "%sn" "Hello, World! n" "From Geeks For Geeksn"
3) %d specifier: It is an integer specifier for showing the integral values.
The ‘echo’ Command
• echo command in linux is used to display line of text/string that are passed as an
argument . This is a built in command that is mostly used in shell scripts and
batch files to output status text to the screen or a file.
Syntax:
Echo [option] [string]
The ‘lp’ Command
• The lp command in Linux stands for 'Line printer' which lets you print the files
through the terminal. There is no need to change or manage the settings through
the GUI. You can simply manage the printers using lp command. This command
is also known as the printer management command Linux.
• This command is also known as the printer management command Linux. The lp
command in Linux is one of the CUPS i.e. Common Unix Printing System.
Syntax:
lp [filename]
Options of lp command
• d: to print the file using a particular printer.
• -n: print multiple copies of the document.
• -q: Set the priority of the printer in the printer queue.
• -t: to assign a name to the job.
• -o: assigns one or more job.
• -i: specifies an existing job to modify.
• -m: notifies the recipient when the job is completed.
• -h: denotes the hostname of the server.
• -E: forces the encryption while connecting to the server.
The ‘rm’Command
• The 'rm' means remove. This command is used to remove a file. The command
line doesn't have a recycle bin or trash unlike other GUI's to recover the files.
Hence, be very much careful while using this command. Once you have deleted a
file, it is removed permanently.
• Syntax:
rm <filename>
• Example:
rm myfile1
Options in rm
• rm *extension - Used to delete files having same extension.
• rm -r or R - To delete a directory recursively.
• rm –i - Remove a file interactively.
• rm –rf - Remove a directory forcefully.
The ‘cp’
Command
• cp stands for copy. This
command is used to copy files or
group of files or directory. It
creates an exact image of a file on
a disk with different file
name. cp command require at
least two filenames in its
arguments.
Syntax: cp [Source file]
[destination file]
cp –R : If the command contains two directory names, cp copies all files of the source
directory to the destination directory, creating any files or directories needed. This mode of
operation requires an additional option, typically R, to indicate the recursive copying of
directories.
• Syntax: cp -R [Src_dir] [des_dir]
cp -i : i stands for Interactive copying. With this option system first warns the user before
overwriting the destination file. cp prompts for a response, if you press y then it overwrites
the file and with any other option leave it uncopied.
• Synatx: cp –I [Src_file] [des_file]

Weitere ähnliche Inhalte

Was ist angesagt?

Linux commands part -2
Linux commands part -2Linux commands part -2
Linux commands part -2bhatvijetha
 
Basic linux commands
Basic linux commands Basic linux commands
Basic linux commands Raghav Arora
 
Compression
CompressionCompression
Compressionaswathyu
 
Linux basic commands with examples
Linux basic commands with examplesLinux basic commands with examples
Linux basic commands with examplesabclearnn
 
Basic command ppt
Basic command pptBasic command ppt
Basic command pptRohit Kumar
 
Course 102: Lecture 17: Process Monitoring
Course 102: Lecture 17: Process Monitoring Course 102: Lecture 17: Process Monitoring
Course 102: Lecture 17: Process Monitoring Ahmed El-Arabawy
 
Basic commands
Basic commandsBasic commands
Basic commandsambilivava
 

Was ist angesagt? (12)

Linux commands part -2
Linux commands part -2Linux commands part -2
Linux commands part -2
 
Linux Commands
Linux CommandsLinux Commands
Linux Commands
 
Basic linux commands
Basic linux commands Basic linux commands
Basic linux commands
 
Compression
CompressionCompression
Compression
 
Linux basic commands with examples
Linux basic commands with examplesLinux basic commands with examples
Linux basic commands with examples
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Basic command ppt
Basic command pptBasic command ppt
Basic command ppt
 
Course 102: Lecture 17: Process Monitoring
Course 102: Lecture 17: Process Monitoring Course 102: Lecture 17: Process Monitoring
Course 102: Lecture 17: Process Monitoring
 
Linux day 1
Linux day 1Linux day 1
Linux day 1
 
Basic Linux day 2
Basic Linux day 2Basic Linux day 2
Basic Linux day 2
 
Linux
LinuxLinux
Linux
 
Basic commands
Basic commandsBasic commands
Basic commands
 

Ähnlich wie Group13

Ähnlich wie Group13 (20)

Linux
LinuxLinux
Linux
 
Linux file commands and shell scripts
Linux file commands and shell scriptsLinux file commands and shell scripts
Linux file commands and shell scripts
 
Linux commands
Linux commandsLinux commands
Linux commands
 
LinuxCommands (1).pdf
LinuxCommands (1).pdfLinuxCommands (1).pdf
LinuxCommands (1).pdf
 
Prabu linux
Prabu linuxPrabu linux
Prabu linux
 
Linux Basics.pptx
Linux Basics.pptxLinux Basics.pptx
Linux Basics.pptx
 
2. UNIX OS System Architecture easy.pptx
2. UNIX OS System Architecture easy.pptx2. UNIX OS System Architecture easy.pptx
2. UNIX OS System Architecture easy.pptx
 
Babitha.linux
Babitha.linuxBabitha.linux
Babitha.linux
 
Babitha.linux
Babitha.linuxBabitha.linux
Babitha.linux
 
Babitha.linux
Babitha.linuxBabitha.linux
Babitha.linux
 
Babitha.linux
Babitha.linuxBabitha.linux
Babitha.linux
 
Babitha.linux
Babitha.linuxBabitha.linux
Babitha.linux
 
Babitha.linux
Babitha.linuxBabitha.linux
Babitha.linux
 
Babitha.linux
Babitha.linuxBabitha.linux
Babitha.linux
 
Unix Shell Script - 2 Days Session.pptx
Unix Shell Script - 2 Days Session.pptxUnix Shell Script - 2 Days Session.pptx
Unix Shell Script - 2 Days Session.pptx
 
Linux presentation
Linux presentationLinux presentation
Linux presentation
 
Linux
LinuxLinux
Linux
 
Linux administration training
Linux administration trainingLinux administration training
Linux administration training
 
40 basic linux command
40 basic linux command40 basic linux command
40 basic linux command
 
40 basic linux command
40 basic linux command40 basic linux command
40 basic linux command
 

Kürzlich hochgeladen

Digital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of DrupalDigital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of DrupalFabian de Rijk
 
Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...
Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...
Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...ZurliaSoop
 
Dreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video TreatmentDreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video Treatmentnswingard
 
Introduction to Artificial intelligence.
Introduction to Artificial intelligence.Introduction to Artificial intelligence.
Introduction to Artificial intelligence.thamaeteboho94
 
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfAWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfSkillCertProExams
 
Dreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIIDreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIINhPhngng3
 
Unlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven Curiosity
Unlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven CuriosityUnlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven Curiosity
Unlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven CuriosityHung Le
 
SOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdf
SOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdfSOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdf
SOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdfMahamudul Hasan
 
Zone Chairperson Role and Responsibilities New updated.pptx
Zone Chairperson Role and Responsibilities New updated.pptxZone Chairperson Role and Responsibilities New updated.pptx
Zone Chairperson Role and Responsibilities New updated.pptxlionnarsimharajumjf
 
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...amilabibi1
 
My Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle BaileyMy Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle Baileyhlharris
 
lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lodhisaajjda
 
Report Writing Webinar Training
Report Writing Webinar TrainingReport Writing Webinar Training
Report Writing Webinar TrainingKylaCullinane
 
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...David Celestin
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoKayode Fayemi
 

Kürzlich hochgeladen (17)

Digital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of DrupalDigital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of Drupal
 
Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...
Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...
Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...
 
Dreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video TreatmentDreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video Treatment
 
Introduction to Artificial intelligence.
Introduction to Artificial intelligence.Introduction to Artificial intelligence.
Introduction to Artificial intelligence.
 
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfAWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
 
Dreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIIDreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio III
 
Unlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven Curiosity
Unlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven CuriosityUnlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven Curiosity
Unlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven Curiosity
 
SOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdf
SOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdfSOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdf
SOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdf
 
in kuwait௹+918133066128....) @abortion pills for sale in Kuwait City
in kuwait௹+918133066128....) @abortion pills for sale in Kuwait Cityin kuwait௹+918133066128....) @abortion pills for sale in Kuwait City
in kuwait௹+918133066128....) @abortion pills for sale in Kuwait City
 
ICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdfICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdf
 
Zone Chairperson Role and Responsibilities New updated.pptx
Zone Chairperson Role and Responsibilities New updated.pptxZone Chairperson Role and Responsibilities New updated.pptx
Zone Chairperson Role and Responsibilities New updated.pptx
 
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
 
My Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle BaileyMy Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle Bailey
 
lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.
 
Report Writing Webinar Training
Report Writing Webinar TrainingReport Writing Webinar Training
Report Writing Webinar Training
 
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac Folorunso
 

Group13

  • 1. PSG COLLEGE OF TECHNOLOGY 20MX15 - UNIX ARCHITECTURE AND PROGRAMMING By 21MX124 - Sandhiya M. 21MX207 - Karpaga Prasanth K. 21MX210 - Maheash Kumar M. 21MX213 - Om Raju V. Ms. A. Kalyani Asst.Professor MCA (PSG)
  • 2. The ‘cd’ Command The ‘cd’ Command is used to change the current directory to another directory. Syntax: cd [directory path]
  • 3. The ‘bc’ Command • bc command is used for command line calculator. It is similar to basic calculator by using which we can do basic mathematical calculations. Arithmetic operations are the most basic in any kind of programming language. Linux or Unix operating system provides the bc command and expr command for doing arithmetic calculations. You can use these commands in bash or shell script also for evaluating arithmetic expressions. Syntax: Bs [-hlwsqv] [more options] [file…]
  • 4. bc - Supports • Arithmetic operators. • Increment or Decrement operators. • Assignment operators. • Comparison or Relational operators. • Logical or Boolean operators. • Math functions. • Conditional statements. • Iterative statements.
  • 5. The ‘man’ Command • Man command in Linux is used to display the user manual of any command that we can run on the terminal. provides a detailed view of the command which includes NAME, SYNOPSIS, DESCRIPTION, OPTIONS, EXIT STATUS, RETURN VALUES, ERRORS, FILES, VERSIONS, EXAMPLES, AUTHORS and SEE ALSO. Syntax: $man [options] [command name]
  • 6.
  • 7. The ‘who’ Command • The Linux "who" command lets you display the users currently logged in to your UNIX or Linux operating system. Whenever a user needs to know about how many users are using or are logged-in into a particular Linux-based operating system, he/she can use the "who" command to get that information.
  • 8. The ‘whoami’ Command • It displays the username of the current user when this command is invoked. • Displays user, group and privileges information for the user who is currently logged on to the local system. If used without parameters, whoami displays the current domain and user name.
  • 9. The ‘pwd’ Command • pwd stands for Print Working Directory. It prints the path of the working directory, starting from the root. pwd is shell built-in command(pwd). • Options: pwd -l : Prints the symbolic path. pwd –p : Prints the Actual path.
  • 10. The ‘mkdir’ Command • Mkdir stands for make directory . • The “mkdir” command is used to create a directory. • -p: option create a hierarchy of directories. Syntax: mkdir [directory path] ubuntu@ubuntu-VirtualBox:~$ mkdir folder ubuntu@ubuntu-VirtualBox:~$ mkdir folder1 ubuntu@ubuntu-VirtualBox:~$ mkdir -p folder1/subfolder/anotherfolder
  • 11. The ‘rmdir’ Command Rmdir stands for remove directory. The “rmdir” command is used to remove directory. • Syntax: rmdir [directory path] • ubuntu@ubuntu-VirtualBox:~$ rmdir folder
  • 12. The ‘ls’ Command The Linux ls command allows you to view a list of the files and folders in a given directory. You can also use this command to display details of a file, such as the owner of the file and the permissions assigned to the file. • ubuntu@ubuntu-VirtualBox:~$ ls • 21mx124_practice_commands Documents Music samplefile Videos • 21mx124_practice_commands_2 Downloads Pictures samplefile1 • Desktop folder1 Public Templates
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20. The ‘Touch’ Command The touch command is a standard command used in UNIX/Linux operating system which is used to create, change and modify timestamps of a file. • Syntax: Touch [File_name] • ubuntu@ubuntu-VirtualBox:~$ touch samplefile • ubuntu@ubuntu-VirtualBox:~$ touch samplefile1 • ubuntu@ubuntu-VirtualBox:~$ ls • 21mx124_practice_commands Documents Music samplefile Videos • 21mx124_practice_commands_2 Downloads Pictures samplefile1 • Desktop folder1 Public Templates
  • 21. The ‘mv’ Command mv stands for move. mv is used to move one or more files or directories from one place to another in a file system like UNIX. It has two distinct functions. • It renames a file or folder. • It moves a group of files to a different directory.
  • 22. The ‘date’ Command • Date command is used to display the system date and time. It is also used to set date and time of the system. • By default the date command displays the date in the time zone on which unix operating system is configured. • You must be the super-user to change the date and time. Syntax: $date
  • 23. The ‘cat’ Command Cat command stands for concatenate. It reads data from the file and gives their content as output. It helps us to create, view, and concatenate files. Frequently used cat commands: • To view a single file . Command: $cat filename • To view multiple files Command: $cat file1 file2
  • 24. • Create a file Command: $ cat >newfile • Copy the contents of one file to another file. Command: $cat [filename-whose-contents-is-to-be-copied] > [destination-filename]
  • 25. The ‘More’ Command • more command is used to view the text files in the command prompt, displaying one screen at a time in case the file is large. • The more command also allows the user do scroll up and down through the page. • When the output is large, we can use more command to see output one by one. • Another application of more is to use it with some other command after a pipe.
  • 26. Syntax: The syntax along with options and command is as follows. more [-options] [-num] [+/pattern] [+linenum] [file_name] [-options]: any option that you want to use in order to change the way the file is displayed. (-d, -l, -f, -p, -c, -s, -u) [-num]: type the number of lines that you want to display. [+/pattern]: replace the pattern with any string that you want to find in the text file. [+linenum]: use the line number from where you want to start displaying the text content. [file_name]: name of the file containing the text that you want to display on the screen.
  • 27. The ‘less’ Command • Less command is used to read the contents of a file one page at a time. • It has faster access because if file is large it doesn’t access the complete file, but accesses it page by page. • For example, if it’s a large file and you are reading it using any text editor, then the complete file will be loaded to main memory. The less command doesn’t load the entire file, but loads it part by part which makes it faster. Syntax : less filename
  • 28. The ‘print’ Command • printf command is used to display the given string, number or any other format specifier on the terminal. • It works the same way as “printf” works in programming languages like C. Syntax: $printf [-v var] format [arguments] The most commonly used printf specifiers are %s, %b, %d, %x and %f. 1) %s : It is basically a string specifier for string output. $printf "%sn" "Hello, World!" 2) %b : It is same as string specifier but it allows us to interpret escape sequences with an argument. printf "%sn" "Hello, World! n" "From Geeks For Geeksn" 3) %d specifier: It is an integer specifier for showing the integral values.
  • 29.
  • 30. The ‘echo’ Command • echo command in linux is used to display line of text/string that are passed as an argument . This is a built in command that is mostly used in shell scripts and batch files to output status text to the screen or a file. Syntax: Echo [option] [string]
  • 31. The ‘lp’ Command • The lp command in Linux stands for 'Line printer' which lets you print the files through the terminal. There is no need to change or manage the settings through the GUI. You can simply manage the printers using lp command. This command is also known as the printer management command Linux. • This command is also known as the printer management command Linux. The lp command in Linux is one of the CUPS i.e. Common Unix Printing System. Syntax: lp [filename]
  • 32. Options of lp command • d: to print the file using a particular printer. • -n: print multiple copies of the document. • -q: Set the priority of the printer in the printer queue. • -t: to assign a name to the job. • -o: assigns one or more job. • -i: specifies an existing job to modify. • -m: notifies the recipient when the job is completed. • -h: denotes the hostname of the server. • -E: forces the encryption while connecting to the server.
  • 33. The ‘rm’Command • The 'rm' means remove. This command is used to remove a file. The command line doesn't have a recycle bin or trash unlike other GUI's to recover the files. Hence, be very much careful while using this command. Once you have deleted a file, it is removed permanently. • Syntax: rm <filename> • Example: rm myfile1
  • 34. Options in rm • rm *extension - Used to delete files having same extension. • rm -r or R - To delete a directory recursively. • rm –i - Remove a file interactively. • rm –rf - Remove a directory forcefully.
  • 35. The ‘cp’ Command • cp stands for copy. This command is used to copy files or group of files or directory. It creates an exact image of a file on a disk with different file name. cp command require at least two filenames in its arguments. Syntax: cp [Source file] [destination file]
  • 36. cp –R : If the command contains two directory names, cp copies all files of the source directory to the destination directory, creating any files or directories needed. This mode of operation requires an additional option, typically R, to indicate the recursive copying of directories. • Syntax: cp -R [Src_dir] [des_dir] cp -i : i stands for Interactive copying. With this option system first warns the user before overwriting the destination file. cp prompts for a response, if you press y then it overwrites the file and with any other option leave it uncopied. • Synatx: cp –I [Src_file] [des_file]