Netaji Subhash Engineering College: Uni. Roll-10931121046 Name - OS Lab Sub. - PCC-CSBS602 (6959) Dep. - CSBS Sem. - 6th
Netaji Subhash Engineering College: Uni. Roll-10931121046 Name - OS Lab Sub. - PCC-CSBS602 (6959) Dep. - CSBS Sem. - 6th
-----------------------
$ whoami
The whoami command in Unix is used to display the
username of the current user who is logged in to the
system. It's handy for quickly determining the identity of
the user we're logged in .
$ pwd
The pwd command stands for "print working directory".
When we run it in a Unix terminal, it will display the full
pathname of the current working directory, showing us
where we are within the file system.
$ touch
The touch command is used to create an empty file. In this
case, we've created a file named "f" in the current directory.
If we want to verify that the file was created, we can use
the ls command to list the files in the current directory.
$ ls
Running the `ls` command lists the files and directories in
the current directory. If we've just created a file named "f"
using the `touch` command, we should see it listed when
we run `ls`.
$ ls -l
The `ls -l` command provides a detailed listing of files and
directories in the current directory. It displays additional
information such as file permissions, owner, group, file size,
and modification time. If werun `ls -l`, we'll see a detailed
listing of all files and directories in the current directory.
$cat > a
The command `cat > a` is used to create or modify a file
named "a" and allows to enter text into that file directly
from the terminal. After executeing this command, we can
start typing the text we want to add to the file. When
we're done, we can press Ctrl+D to save the changes and
exit.
$cat a
By useing the `cat a` command, it will display the contents
of the file named "a" in the terminal.
$ wc a
The `wc` command is used to display the number of lines,
words, and bytes contained in a file. If we run `wc a`, it will
provide the line count, word count, and byte count of the
file named "a".
$ wc -c a
The `wc -c a` command will provide with the byte count of
the file named "a". It counts the number of bytes in the file.
$ wc -l a
The `wc -l a` command will provide with the line count of
the file named "a". It counts the number of lines in the file.
$ cp
$ Date revisited
The `date` command with various format specifiers:
- `%A`: Displays the full name of the day of the week
(Wednesday).
- `%a`: Displays the abbreviated name of the day of the
week (Wed).
- `%Y`: Displays the current year (2024).
- `%y`: Displays the last two digits of the year (24).
- `%m`: Displays the current month (01, which represents
January).
- `%M`: Displays the current minute (46).
- `%S`: Displays the current second (29).
- `%s`: Displays the number of seconds since the Unix
Epoch (January 1, 1970).
- `%H`: Displays the current hour in 24-hour format (17,
which represents 5 PM).
$ Date contd.
$ bc
The bc command is a calculator that allows us to perform
arithmetic calculations in the Unix terminal.
In this case we are usign 3+6 to demonstrate its
functionality