Unit 1 Part 2 Operating System
Unit 1 Part 2 Operating System
Unit 1 Part 2 Operating System
The source code of Linux is freely The source code of Unix is not freely
available to its users available general public
https://www.geeksforgeeks.org/date-command-linux-
examples/
whoami
whoami command is used both in Unix Operating
System and as well as in Windows Operating System.
It is basically the concatenation of the
strings “who”,”am”,”i” as whoami.
It displays the username of the current user when this
command is invoked.
It is similar as running the id command with the
options -un.
Whoami –version
who
Report which users are logged in to the system.
w
Show who is logged on and what they are doing.
cal
the cal command shows the current month calendar as
output.
cal command is a calendar command in Linux which
is used to see the calendar of a specific month or a
whole year.
Cal –y
cal 02 2021 : Shows calendar of selected month and year.
cal 2021 | more : But year may not be visible in the same screen use more with
cal use spacebar to scroll down.
https://www.geeksforgeeks.org/cal-command-in-linux-with-examples/
bc
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.
There are two main ways in which the bc command
works. The first is through entering an interactive
mathematical shell. We can enter the shell by simply
running the bc command by itself.
Once we’re in, we can start executing some basic
mathematical operations.
But we can also perform mathematical operations in
the Linux terminal using bc without entering the
interactive shell. For this process, we’ll need to utilize
the echo command and | pipes. This will echo any text
we type and pass it to the bc command.
We can also use bc to compute numerous
mathematical operations that are contained in a text
file. Simply pass a text file filled with math equations
to the bc command and let it do its job.
hostname
Linux hostname command allows us to set and view
the hostname of the system. A hostname is the name
of any computer that is connected to a network that is
uniquely identified over a network. It can be accessed
without using a particular IP address.
https://www.geeksforgeeks.org/hostname-command-
in-linux-with-examples/
uname
The command ‘uname‘ displays the information about the system.
basic directory navigation
commands
cd
Linux cd command is used to change the current
working directory ( i.e., in which the current user is
working). The "cd" stands for 'change directory.' It is
one of the most frequently used commands in the
Linux terminal.
mv
Linux mv command is used to move existing file or
directory from one location to another. It is also used
to rename a file or directory.
Renaming a file in Linux
copy
cp stands for a copy. This command is used to copy
files or groups of files or directories. It creates an exact
image of a file on a disk with a different file
name. cp command requires at least two filenames in
its arguments.
https://www.geeksforgeeks.org/cp-command-linux-
examples/
If the command contains two file names, then it
copies the contents of 1st file to the 2nd file. If the
2nd file doesn’t exist, then first it creates one, and
content is copied to it. But if it existed then it is simply
overwritten without any warning. So be careful when
you choose the destination file name.
Copy more than one file into directory
rm
The 'rm' means remove. This command is used to
remove a file.
No output is produced by rm, since it typically only
generates messages in the case of an error.
-i (Interactive Deletion): the -i option makes the
command ask the user for confirmation before
removing each file, you have to press y for confirm
deletion, any other key leaves the file un-deleted.
-f (Force Deletion): rm prompts for confirmation
removal if a file is write protected. The -f option
overrides this minor protection and removes the file
forcefully.
cat
Cat is short for concatenate. This command displays
the contents of one or more files without having to
open the file for editing.
Cat(concatenate) command is very frequently used in
Linux. It reads data from the file and gives its content
as output. It helps us to create, view, and concatenate
files.
1) To view a single file
2) To view multiple files
To view contents of a file preceding with line
numbers.
Vi Editor
The vi editor is elaborated as visual editor. It is
installed in every Unix system. In other words, it is
available in all Linux distros. It is user-friendly and
works same on different distros and platforms. It is a
very powerful application.
The vi editor has two modes:
Command Mode: In command mode, actions are taken on the
file. The vi editor starts in command mode. Here, the typed
words will act as commands in vi editor. To pass a command, you
need to be in command mode.
Insert Mode: In insert mode, entered text will be inserted into
the file. The Esc key will take you to the command mode from
insert mode.
By default, the vi editor starts in command mode. To enter text,
you have to be in insert mode, just type 'i' and you'll be in insert
mode. Although, after typing i nothing will appear on the screen
but you'll be in insert mode. Now you can type anything.
To exit from insert mode press Esc key, you'll be directed to
command mode.
The vi editor tool is an interactive tool as it displays
changes made in the file on the screen while you edit
the file.
In vi editor you can insert, edit or remove a word as
cursor moves throughout the file.
The vi editor is case-sensitive.