Rishabh Linux File
Rishabh Linux File
Batch: 23
SAP ID: 500119057
Roll No: 713
Submitted To: Mr. Arun Singh Bhadhwal
Ques) What is Linux.
Ans) Full Form of LINUX is Lovable Intellect Not Using XP. Linux was built by and
named after Linus Torvalds. Linux is an open-source operating system for servers,
computers, mainframes, mobile systems, and embedded systems. Requests from
device software are handled by Linux and relayed to computer hardware.
ls [option] [file/directory]
ls will display the contents of the current directory. By default, ls lists files and
directories in alphabetical order.
cd [directory]
Here, replace [directory] with the path of the destination directory you want to
navigate to.
pwd stands for Print Working Directory. It prints the path of the working
directory, starting from the root. pwd is shell built-in command(pwd) or an
actual binary(/bin/pwd). PWD is an environment variable that stores the path
of the current directory. This command has two flags.
pwd [OPTIONS]
This command doesn’t have any arguments or options, but it can accept flags
for specific behaviour.
Mkdir (directory):
create new directories
mkdir command in Linux allows the user to create directories (also referred to
as folders in some operating systems). This command can create multiple
directories at once as well as set the permissions for the directories. It is
important to note that the user executing this command must have enough
permission to create a directory in the parent directory, or he/she may receive
a ‘permission denied’ error.
Syntax:
https://usatrendings.net/
The rmdir command is useful when you want to remove the empty directories
from the filesystem in Linux. This command lets you specify the terminal
to remove a particular directory right from the terminal. However, having
correct knowledge of the rmdir command is essential, or you may end up
deleting any important directory.
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.
Syntax:
The first and second syntax is used to copy the Source file to the Destination
file or Directory. The third syntax is used to copy multiple Sources(files) to
the Directory.
3. mv(move):
move or rename file and directories
Syntax:
rm [OPTION]... FILE...
1. cat:
display file contents
less:
Less command is a Linux utility that can be used to read the contents of
a text file one page (one screen) at a time. It has faster access because if
a file is large, it doesn’t access the complete file, but accesses it page by
page. For example, if it’s a large file and you are reading it using any
text editor, then the complete file will be loaded to the main memory.
The less command doesn’t load the entire file but loads it part by part
which makes it faster.
more:
more command is used to view the text files in the command prompt,
displaying one screen at a time in case the file is large (For example log
files). The more command also allows the user do scroll up and down
through the page. The syntax along with options and command is as
follows. Another application of more is to use it with some other
command after a pipe. When the output is large, we can use more
command to see output one by one.
Syntax:
1. whoami:
display the current user
2. who:
show users currently logged in
who command is used to find out the following information:
1. Time of last system boot
2. Current run level of the system
3. List of logged in users and more.
Description: The who command is used to get information about currently
logged in user on to system.
Syntax: $who [options] [filename]
VI
EDITOR:
The default editor that comes with the UNIX operating system is
called vi (visual editor). Using vi editor, we can edit an existing file or create a
new file from scratch. we can also use this editor to just read a text file. The
advanced version of the vi editor is the vim editor.
How to open VI editor?
EXPERIMENT 3:
(i) Files and Directories commands
Working with Files:
1. touch: Create an empty file or update the access/modify timestamps of an
existing file.
2. cp: Copy files and directories.
3. mv: Move or rename files and directories.
4. rm: Remove files and directories.
5. cat: Concatenate and display the contents of a file.
6. less: Display the contents of a file one page at a time.
7. head: Display the first few lines of a file.
8. tail: Display the last few lines of a file.
STEP 1: Make directory by mkdir command and then move to that particular directory
by cd command.
STEP 3: Use cat command to concentrate/ display the contents of the file. Then use cp
command to copy the file. And in the end by ls command, the result will be displayed.
Syntax: cat (file name)
(ii)
(iii) File Permissions and Ownership:
The ls is the list command in Linux. It will show the full list or content of your
directory.
o -l: It stands for long format. It shows Unix file types, number of hard links,
permissions, group, owner, last modified name and date-time, and size.
If the changed date is older than six months, the time is substituted with
the year. A few implementations add extra flags to permissions
II} Discuss the three sets of permissions: owner, group, and others.
When permissions and users are represented by letters, that is called symbolic mode.
The first digit is for owner permissions, the second digit is for group permissions, and
the third is for other users. Each permission has a numeric value assigned to it:
r (read): 4
w (write): 2
x (execute): 1
For example, a file might have read, write, and execute permissions for its owner, and
only read permission for all other users. That looks like this:
The group permissions apply only to the group that has been
‘g’ Group assigned to the file or directory.
‘o’ Others The other permissions apply to all other users on the system.
Operators Definition
III} Explain the chmod command to modify file permissions and discuss the chown and
chgrp commands to change file ownership and group-
We can modify file and directory permissions with the chmod command, which stands
for "change mode." To change file permissions in numeric mode, you enter chmod and
the octal value you desire. To change file permissions in symbolic mode, you enter a
user class and the permissions you want to grant them next to the file name. For
example:
These grants read, write, and execute for the user and group, and only read for others.
What is a “Shell”?
It is a program that provides the user an interface to use operating system services.
1. Write a simple shell script that prints “Hello, World!” when executed.