100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Unix Commands in Operating systems $4.59   Add to cart

Class notes

Unix Commands in Operating systems

 4 views  0 purchase
  • Course
  • Institution

In these notes, Covered all the topics of operating systems briefly. COs - Analyze the structure of OS and basic architectural components involved in OS design. Compare and contrast various CPU scheduling algorithms. Evaluate the requirements for the process synchronization and co-ordinatio...

[Show more]

Preview 4 out of 34  pages

  • December 30, 2022
  • 34
  • 2021/2022
  • Class notes
  • Ymk sir
  • All classes
avatar-seller
Unix Commands
1) cal:- Displays a calendar
Syntax:- cal [options] [ month ] [year]
Description :-
➢ cal displays a simple calendar. If arguments are not specified, the current month is
displayed. The switching options are as follows:
-1 Display single (current) month output. (This is the default.)
-3 Display prev/current/next month output
-s Display Sunday as the first day of the week (This is the default.)
-m Display Monday as the first day of the week
-j Display Julian dates (days one-based, numbered from January 1)
-y Display a calendar for the current year
Example:-
$cal
or
$cal 02 2016
Feb 2016

Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29

2) clear :- It clears the terminal screen.
Syntax :- clear
Description :-
➢ Clear clears your screen if this is possible, including its scroll back buffer.
➢ Clear ignores any command-line parameters that may be present.

3) pwd :- Displays path from root to current directory
Syntax :- pwd [options]
Example:
$ pwd
/home/kumar/progs


4) cd:- It is used to change the directory.
Syntax :- cd [directory]
Description:-

1

, Unix Commands
➢ Used to go back one directory on the majority of all UNIX shells. It is important
that the space be between the cd and directory name or ..
Example:-
$ pwd
/home/kumar
$ cd progs
$ pwd
/home/kumar/progs
$ cd ..
/home/kumar

5) ls:- Lists the contents of a directory
Syntax :- ls [options]
Description :-
-a Shows you all files, even files that are hidden (these files begin with a dot.)
-A List all files including the hidden files. However, does not display the working
directory (.) or the parent directory (..).
-d If an argument is a directory it only lists its name not its contents
-l Shows you huge amounts of information (permissions, owners, size, and when last
modified.)
-p Displays a slash ( / ) in front of all directories
-r Reverses the order of how the files are displayed
-R Includes the contents of subdirectories
Example:-
$ ls – l
-rw-r----- 1 student student 23 Jan 16 15:27 file1.txt
Field Explanation:
➢ If first character is – then it is normal file
➢ If it is d then it is directory
➢ Field 1 – File Permissions: Next 9 character specifies the files permission. Each 3
characters refers to the read, write, execute permissions for user, group and world
In this example, -rw-r—– indicates read-write permission for user, read permission
for group, and no permission for others.
➢ Field 2 – Number of links: Second field specifies the number of links for that file. In
this example, 1 indicates only one link to this file.
➢ Field 3 – Owner: Third field specifies owner of the file. In this example, this file is
owned by username ‘student’.
➢ Field 4 – Group: Fourth field specifies the group of the file. In this example, this file
belongs to ”student’ group.
➢ Field 5 – Size: Fifth field specifies the size of file. In this example, ’13′ indicates the

2

, Unix Commands
file size.
➢ Field 6 – Last modified date & time: Sixth field specifies the date and time of the
last modification of the file. In this example, ‘Jan 16 15:27′ specifies the last
modification time of the file.
➢ Field 7 – File or directory name: The last field is the name of the file or directory.
In this example, the file name is file1.txt


6) exit :- It is used to terminate a program, shell or log you out of a network normally.
Syntax :- exit

7) echo :- It prints the given input string to standard output.
Syntax :- echo string
Example:-
$ echo “hi.. hello unix”
hi.. hello unix

8) who :- who command can list the names of users currently logged in, their terminal, the
time they have been logged in, and the name of the host from which they have logged in.
Syntax :- who [options] [file]
Description:-
Print the username of the invoking user, The 'am' and 'i' must be space
am i
separated.
-b Prints time of last system boot.
-d print dead processes.
-H Print column headings above the output.
Include idle time as HOURS:MINUTES. An idle time of . indicates activity
-l
within the last minute.
-m Same as who am i.
-q Prints only the usernames and the user count/total no of users logged in.
Example :-
$ who
dietstaffpts/1 2016-02-20 22:42 (:0.0)
dietstaffpts/2 2016-02-20 09:30 (:0.0)
➢ Here first column shows user name, second shows name of the terminal the user
is working on. Third& fourth column shows date and time of logging, last column
shows machine name.

9) who am i:- Print effective userid
Syntax :- who am i

3

, Unix Commands
Description: - Print the user name associated with the current effective user id.
Example :-
$ who am i
dietstaffpts/3 2016-02-10 08:52 (:0.0)
➢ Here first column shows user name, second shows name of the terminal the user
is working on. Third & fourth column shows date and time of logging, last column
shows machine name.

10) mkdir:- This command is used to create a new directory
Syntax :- mkdir [options] directory
Description :-

-m Set permission mode (as in chmod)
-p No error if existing, make parent directories as
needed.
-v Print a message for each created directory
directory The name of the directory that you wish to
create
Example:-
$ mkdir aaa
➢ The above command will create directory named aaa under the current directory.
We can also create number of subdirectories with one mkdir command.

11) rmdir:- It is used to delete/remove a directory and its subdirectories.
Syntax :- rmdir [options..] Directory
Description :-
➢ It removes only empty directory.

-p Allow users to remove the directory and its parent directories which become
empty.

12) bc:- bc command is used for command line calculator. It is similar to basic calculator. By
using which we can do basic mathematical calculations.
Syntax :- bc [options]
Description :-
➢ bc is a language that supports arbitrary precision numbers with interactive
execution of statements.
➢ bc starts by processing code from all the files listed on the command line in the
order listed. After all files have been processed, bc reads from the standard input.
All code is executed as it is read.

4

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller vaibhav51ppsv2020. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $4.59. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

73091 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$4.59
  • (0)
  Add to cart