GNU options typically use double hyphens (e.g., ls --help).
Combining Options: Multiple single-letter options can be grouped (e.g., ls -r -x
can be ls -rx).
Ambiguity with Hyphens: Avoid using hyphens in filenames to prevent confusion.
The kernel serves as the core component that facilitates communication between
hardware and software, while the shell acts as the user interface for executing
commands.
--The operating system comprises two main components: the kernel (innermost part)
and the shell (outermost part), which serves as the user interface.
--The command line is where users input commands; its syntax includes the command
itself and any required arguments, separated by spaces.
--Commands may require one or more arguments to function correctly; missing or
incorrect arguments lead to usage error messages.
--The shell processes commands by checking if the entered command corresponds to an
existing executable; if not, it displays an error.
--Options modify the behavior of commands and can be combined; they often begin
with single or double hyphens, depending on the utility.
Cat Utility
it takes the filename as the argument and displays its contents
when cat is given without any argument, it takes as input whatever you write till
you press ctrl+d.
pressing CTRL+D sends eof message.
Redirection
Various ways you can cause the shell alter standard I/O.
redirect output symbol (>) tells shells to show output in file
cmd [args] > filename = creates file
also once you enter the text and press return you can't edit the text
it also used to catenate two files
cat file1.txt file2.txt > file3.txt = catenate the contents of file 1 and 2 and
stores in file 3
cat > filename = enters whatever you type into file
redirect input symbol(<)
-Here we are taking input from any file and not from keyboard
cmd [args] < filename = here args are optional
ex : cat < filename = takes input from file
Appending using cat(>>)
adds information the end of the file and it doesn't overwrites the existing content
of the file
The cat command serves multiple purposes, including displaying file contents,
redirecting output to files, and concatenating multiple files into one. This
functionality highlights the utility of command-line tools in managing text data.
The use of symbols like >, <, and >> enables users to control where data is sent
and from where it is received. This flexibility is vital for file operations and
streamlining command execution.
The standard output is defined as the destination where a program sends
information, which by default is directed to the screen but can also be redirected
to files or printers. Conversely, standard input is the source from which a program
receives data, typically from the keyboard.
noclobber = avoids overwriting critical files
under bash
set -0 noclobber filename = sets the noclobber
set +0 noclobber filename = unsetting the noclobber
/dev/null = making data disappear
echo "hy" > /dev/null = on executing no output