Page 137 - DCAP106_OPERATING_SYSTEM_TOOLS
P. 137
Operating System Tools
Notes After discussing these commands, you will be able to perform different function according to
your requirement in the Linux command line.
8.1.1 Basic Commands
The basic commands are divided into two sub-categories, that is, Directory commands and File
commands.
Directory Commands
Some of the basic directory commands are defined below:
z z pwd: Print working directory
z z mkdir: Create directories
z z cd: Change the current directory
z z rmdir : Remove directories
File Commands
Some of the basic file commands are defined below:
z z ls : List directory contents
z z rm : Remove files
z z cp : Copy files from a source to the same or different target(s)
z z mv : Move file to different targets
z z cat : Read one or more files and print them to standard output. If you need to view contents
of a short file, cat is recommended
z z cmp: Compare two files byte by byte
z z wc: Print the number of new lines, words, and bytes in files
z z du : Estimate disk usage of each file and recursively for directories
z z find: Search for files in directory hierarchy, e.g. find notes.txt
z z grep: Print lines matching a pattern, e.g. grep –i topic notes.txt (topic is the pattern)
z z sort: Sort lines of text files
8.1.2 Editor
Every Linux program is considered as an executable file.
Example: The cp command is provided by the file in /bin/sh which holds the list of
machine instructions.
Likewise, if you are installing a package, let’s say vsftpd, your focus will be modifying its
configuration file, vsftpd.conf present in /etc directory. In this case, we use editors. We use ‘Vim’
frequently.
Did u know? Vim is an advanced text editor that occurs a more complete feature as
compared to the ‘Vi’ text editor. The other text editors are: nano, vi, kate (KDE Advanced
Text Editor), gedit (graphical user interface). For example, vim rabi.c (vim filename).
130 LOVELY PROFESSIONAL UNIVERSITY