A.
# sed '/^#|^$| *#/d' file1.txt
The caret sign followed by the number sign ^#
indicates the beginning of a line, whereas ^$
represents blank lines. The vertical bars indicate boolean operations, whereas the backward slash is used to escape the vertical bars.
A.
Using sed command.
sed 's/ */ /g'
A.
Absolute path refers to the exact path as defined from the root directory. Related path refers to the path related to the current locations.
A.
The 'ls -l' command is used to list down files and folders in alphabetical order. When you use 'ls -lt' is list down files /folders sorted with modified time.
A.
gzip command creates a zip file using given the filename in the same directory.
gunzip command unzip the file.
A.
This can perform using either "tail" or "sed" commands. The easiest way is to use "tail" command.
A.
The Kill command accepts process ID (PID) as an in a parameter. This is applicable only for the processes own by the command executor.
Syntax - kill PID
A.
The general advantage is to execute processes in the background is to get the possibility to execute some other process without waiting for the previous process to get completed. The symbol "&" at the end of the process tells to the shell to execute given a command in the background.
A.
The command "top" displays the CPU usage, process id, and other details.
A.
'ls -lrta' is to display hidden files in current directory
A.
"ps -ef" command is used to find current running process. Also "grep" with a pipe can use to find specific process.
A.
The command "df -kl" use to get a detail description on disk space usage.
A.
"mkdir directory_name" is used to create a new directory.
A.
Either "ping" or "telnet" command can use to confirm a remote host alive or not.
A.
The "history" command display all the command used previously within the session.
A.
"arch" or "uname -a" can use for this process.
A.
"uptime" command returns the number of dates that the server is up.
A.
The "sed" command is available for this process '.sed' stands for a team editor.
A.
"wc -c filename" command can use to retrieve the number of characters in a file and "wc -l filename" command can use to retrieve the number of lines in a file.
A.
"rm -r*" is the command used to erase all files in the current directory including all its sub directories
A.
'cmp' command is basically used for byte by byte comparison of two files to determine the first mismatch byte. This command does not use the directory name and displays the first encountered mismatched byte.
Whereas, 'diff' command’ determines the changes that are to be performed on the files in order to make the two files identical. In this case, directory names can be used.
A.
When two or more commands are required to be used at the same time as well as run them consecutively, 'piping' process is used. Here two commands are connected so that, the output of one program serves as the input for another program. It is denoted by the symbol '|'.
Enlisted below are few commands where piping is used:
A.
Some Filename manipulation commands along with their description is enlisted below in table:
Command | Description |
---|---|
cat filename | Displays contents of the file |
cp source destination | Used to copy source file into the destination |
mv old name new name | Move/rename and old name to the new name |
rm filename | Remove/delete filename |
Touch filename | Changing modification time |
In [-s] old name new name | Creates soft link on old name |
Is -F | Displays information about file type |
A.
Links are defined as a second name which is used to assign more than one name to a file. Although links are referred to as a pointer to another file it cannot be used to link filenames on different computers.
A Symbolic link is also known as the soft link is defined as a special type of file that contains links or references to another file or directory in the form of absolute or relative path. It does not contain the data actually in the target file but the pointer to another entry in the file system. Symbolic links can also be used to create a file system.
A.
A pid is used to denote unique process id. It basically identifies all the processes that run on the Unix system. It does not matter whether the processes are running in the foreground or in the background.
A.
'tee' command is basically used in connection with pipes and filters.
This command basically performs two tasks:
a) Get data from standard input and send it to the standard output.
b) Redirects a copy of the input data to the specified file.
A.
Chmod command is used to change file or directory access permission and is the most frequently used command in Unix. According to mode, chmod command changes the permission of each given file.
The syntax of chmod command is:
Chmod [options] mode filename.
Here in the above format, options could be:
A.
Kernel is the master program with UNIX operating system that controls the resources of the computer. The resources allocation to different users and tasks handle by this section. Kernel do not have direct communication with the user and it starts separate interactive program call shell to each user when login to the system.