You are on page 1of 39

OS LAB EXPERIMENT- 1

NAME: SAKSHI SURESH KOLI


REG NO : 211071067
SY CS

AIM: Study of different Linux and shell commands for process management, file
management, disk management, memory management, as well as user access
commands.

1.mkdir:
Description: mkdir attempts to create a directory named pathname. It creates directory
if they are not present.
Syntax: mkdir[OPTION] DIRECTORY
Options:
-p, --parents (no error if existing, make parent directories as needed)
-v, --verbose(print a message for each created directory)

2.cd:
Description: The cd (“change directory”) command is used to change the current
working directory.
Syntax: cd directory

3. ls
Description: list the elements of the directory. ls" on its own lists all files in the current
directory except for hidden files.
Syntax: ls [options] [file... | directory ...]
Options:
ls -l shows file or directory,size..]

4.cal:
Description: Display the calendar of the current month.
Syntax: cal [-31jy] [-A number] [-B number] [-d yyyy-mm] [[month] year]
Options:
-h Turns off highlighting of today.
-m month(Display the specified month. If month is specified as a decimal number,
appending ‘f’ or ‘p’ displays the same month of the following or previous year
respectively.)

5.factor
Description: Print the prime factors of each specified integer NUMBER.
Syntax: factor [NUMBER]...
Options:none

6.bc:
Description: This command is used to calculate mathematical expressions
Syntax:echo expression|bc
Options:
-l, --mathlib(Define the standard math library.)
-i, --interactive(Force interactive mode.)

OUTPUT:
7.chage:
Description: The chage command changes the number of days between password
changes and the date of the last password change. This information is used by the
system
to determine when a user must change their password.
Syntax:chage[options]
Options:
-i, --iso8601(When printing dates, use YYYY-MM-DD format.)
-d, --lastday LAST_DAY(Set the number of days since January 1st, 1970 when the
password was last changed. The date may also be expressed in the format YYYY-MM-
DD (or the format more commonly used in your area).)

8.df:
Description: This command is used to check disk space usage on a linux system.
Syntax: df [OPTION]... [FILE]
Options:
-a, --all(include pseudo, duplicate, inaccessible file systems)
-i, --inodes(list inode information instead of block usage)
9.cd ..
Description: To exit current directory and go to outside directory
Syntax: cd ..
options: none

10.pwd :
 Description : To Print Working Directory
Syntax: pwd [options] pid [...]
Options:
-V Output version information and exit.
-h Output help screen and exit.

11.ping:
Description:
PING (Packet Internet Groper) command is used to check the network connectivity
between host and server/host. This command takes as input the IP address or the
URL and sends a data packet to the specified address with the message “PING”
and get a response from the server/host this time is recorded which is called
latency. Fast ping low latency means faster connection.Ping is generally measured
in millisecond every modern operating system has this ping pre-installed. 
Syntax: ping - destination

12.uname:
Description: uname command is used to print system information.
Syntax: uname [OPTION]
Options:
-a, --all(print all information, in the following order, except omit -p and -i if unknown:)
-s, --kernel-name(print the kernel name)
-p, --processor(print the processor type (non-portable))
-o, --operating-system(print the operating system)
13.cat:
Description: concatenate files and print on the standard output
Syntax: cat [FILE]
Options:
-n, --number (number all output lines)
3-b, --number-nonblank (number nonempty output lines, overrides -n)

14.gzip:
Description: The gzip command compresses files. By default, it removes the original file
and leaves you with the compressed version.
Syntax:gzip[options][file]
Options:
-k (To retain both the original and the compressed version, use the -k (keep) option.)
15. whatis:
Description: Gives one line description of the command.
Syntax:whatis command
Options:
-d, --debug(Print debugging information.)
-v, --verbose(Print verbose warning messages.)

16.free:
Description: The free command is used to display amount of free and used RAM in the
system, also prints the swap space stats.
Syntax: free [options]
Options:
-b, --bytes (Display the amount of memory in bytes.)
-k, --kibi (Display the amount of memory in kibibytes. This is the default.)
17.top:
Description: display linux processes and system tasks.
Syntax:top [options]
Options:
-b :Batch-mode operation
-c :Command-line/Program-name toggle

18.banner
Description: prints out the first 10 characters of text in large letters.
Syntax: banner text
Options:none

19.echo:
Description: The echo command is used to to output text to the screen. You simply type
echo and then the text you would like to display.
Syntax: echo [SHORT-OPTION][STRING] echo LONG-OPTION
Options:
-n do not output the trailing newline
-e enable interpretation of backslash escapes

20.finger
Description: The finger displays information about the system users
Syntax: finger [-lmps] [login ...]
Options:
-s Finger displays the user's login name, real name, terminal name and write status
-l Produces a multi-line format displaying all of the information
21.groups:
Description: This command prints the group the user is in.
Syntax: groups [OPTION][USERNAME]
Options:
--help
--version
22. head:
Description: if you need to print first few lines of a file(any type) then you can use head
command. By default head command prints first 10 lines.
Syntax: head [OPTION] [FILE]
Options:
-n, --lines=[-]NUM(print the first NUM lines instead of the first 10; with the leading '-',
print all but the last NUM
lines of each file)
-q, --quiet, --silent(never print headers giving file names)

23.man:
Description: an interface to the system reference manuals
Syntax: man [man options] [[section] page ...]
Options:
-C file, --config-file=file(Use this user configuration file rather than the default of
~/.manpath.)
-d, --debug (Print debugging information.)

24..w:
Description: w prints a summary of the current activity on the system, including what
each user is doing, and their processes.
Syntax: w [options] user [...]
Options:
-s, --short(Use the short format. Don't print the login time, JCPU or PCPU times.)
-i, --ip-addr(Display IP address instead of hostname for from field.)
Output:

25.history:
Description: history command prints a list of previously typed commands.
Syntax:history
Options:None
26.ps:
Description: report a snapshot of the current processes.
Syntax: ps [options]
Options:
-A (Select all processes. Identical to -e.)
r (Restrict the selection to only running processes.)

27.kill:
Description: send a signal to a process
Syntax:kill [options]
Options:
-L, --table(List signal names in a nice table.)

28.tail:
Description: It's similar to the head command, but the function is opposite, prints last 10
lines of any file by default.
Syntax: tail [OPTION][FILE]
Options:
-z, --zero-terminated(line delimiter is NUL, not newline)

29.env
Description:Set each NAME to VALUE in the environment and run COMMAND.
Syntax: env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]
Options:
1) -i, --ignore-environment :- start with an empty environment
2) -0, --null :- end each output line with NULL, not newline
3) -u, --unset=NAME :- remove variable from the environment
4) -C, --chdir=DIR :- change working directory to DIR
30.hostname:
Description: show or set the system's host name
Syntax:hostname
Options:
-s, --short(Display the short host name. This is the host name cut at the first dot.)

31.last
Description: Shows a listing of last logged in users.
Syntax: last [options] [username...] [tty...]
Options:
1) -a, --hostlast :- Display the hostname in the last column.
2) -d, --dns :- For non-local logins, Linux stores not only the host name of the
remote host, but its IP number as well.
3) -F, --fulltimes :- Print full login and logout times and dates.
4) -i, --ip :- Like --dns , but displays the host's IP number instead of the name.

32. ifconfig:
Description: Used to configure network interface parameters
Syntax:ifconfig
Options: -a display all interfaces which are currently available, even if down
-s display a short list (like netstat -i)
-v be more verbose for some error conditions
33.pstree
Description: It displays the processes in a neater tree fashion. It is similar to PS
command.
Syntax: pstree
34.sudo:
Description: allows individual users to have root permission to perform specified tasks
Syntax: sudo -h | -K | -k | -V
Options: -h,-K,-k,-V

35.apt-get
Description: apt-get is a command line interface for retrieval of packages and
information about them from authenticated sources and for installation, upgrade and
removal of packages together with their dependencies.
Syntax: apt-get

36.unzip
Description:
Syntax: unzip [-Z] [-opts[modifiers]] file
Options:
-p extract files to pipe, no messages
-l list files (short format)
-f freshen existing files, create none
-t test compressed archive data

37shutdown:
Description: command to shutdown the machine.
Syntax:shutdown[options][time]
Options:
-k (Do not halt, power-off, reboot, just write wall message.)
-c(Cancel a pending shutdown. This may be used to cancel the effect of an invocation of
shutdown with a time argument that is not "+0" or "now".)

38.dir:
Description: This command is used to list directory contents.
Syntax:dir
Options:
-a, --all(do not ignore entries starting with.)
-b, --escape(print C-style escapes for nongraphic characters)

39.sort
Description: This command is used to sort a file, arranging the records in a particular
order. By default, the sort command sorts file assuming the contents are ASCII.
Syntax: sort [filename]
Options: -g, --general-numeric-sort(compare according to general numerical value)

40.touch:
Description: Update the access and modification times of each file to the current time. A
file argument that does not exist is created empty, unless -c or -h is supplied. A file
argument string of - is handled specially and causes touch to change the times of the file
associated with standard output.
Syntax: touch [OPTION] FILE
Options:
-a (change only the access time)
-c, --no-create(do not create any files)
-m (change only the modification time)

41: tac
Description: The 'tac' command is the reverse of the 'cat' command. It is also known as
'cat' backward. It will display the file content in reverse order.
Syntax: tac <file name>
Options:
42. exit:
Description: closes the terminal.
Syntax:exit
Options:none

43. ionice
Description: command used to get or set I/O shecduling class and priority for the
particular process.
Syntax: ionice [operation]
Option: none

44.diff3:
Description: Show differences among three files
Syntax: diff3 [OPTION] MYFILE OLDFILE YOURFILE
Options:
-A, --show-all(output all changes, bracketing conflicts)
-X (like -x, but bracket conflicts)

45. expr:
Description: evaluate expressions
Syntax: expr EXPRESSION
Options:none
46.hostname:
Description: show or set the system's host name
Syntax:hostname
Options:
-s, --short(Display the short host name. This is the host name cut at the first dot.)

47: sl
Description:
This one is just for bit fun during the work and not a useful command. When
executed a steam engine passes through Terminal window.
48.less:
Description: The less command allows you to view files without opening an editor. It’s
faster to use, and there’s no chance of you inadvertently modifying the file.
Syntax:less[options]file
Options:
-c or --clear-screen()Causes full screen repaints to be painted from the top line down. By
default, full screen repaints are done by scrolling from the bottom of the screen.

49.less:
Description: The less command allows you to view files without opening an editor. It’s
faster to use, and there’s no chance of you inadvertently modifying the file.
Syntax:less[options]file
Options:
-c or --clear-screen()Causes full screen repaints to be painted from the top line down. By
default, full screen repaints are done by scrolling from the bottom of the screen.

50.!!:
Description: Repeats the last command
Syntax:!!
Options:none

51.jobs:
Description: List active jobs
Syntax:jobs
Options:none

52. info:
Description: read Info documents
Syntax: info [OPTION][MENU-ITEM...]
Options:
-a, --all(use all matching manuals)
-d, --directory=DIR(add DIR to INFOPATH)

53.nmap:
Description: Checks opened port on the server
Syntax:nmap[hostname][port]
Options: -p,-h
54.cp:
Description: copies on or more files. Recursive copying is one simple way of archiving
part of a directory structure.
Syntax:cp[options][source][directory]
Options:
--attributes-only(don't copy the file data, just the attributes)
-l, --link(hard link files instead of copying)

55fc:
Description: views, edits, and executes commands for the history list. This is a shell
builtin.
33Syntax:fc
Options:none

56.adduser
Description: Add a user to the system
Syntax: adduser [options]
Options:
1) --disabled-login :- The user won't be able to use her account until the
password is set.
2) --help :- Display brief instructions.

57.users
Description: print the user names of users currently logged in to the current host.
Syntax: users [OPTION]... [FILE]
Options:
1) --help :- display this help and exit
2) –version :- output version information and exit

58.groupadd
Description: Create a new group.
Syntax: groupadd [options] group
Options:
1) -f, --force :- This option causes the command to simply exit with success
status.
2) -o, --non-unique :- This option permits to add a group with a non-unique GID.
3) -r, --system :- Create a system group.

59.groupdel
Description: Deletes a group.
Syntax: groupdel [options] GROUP
Options:
1) -h, --help :- Display help message and exit.
2) -R, --root CHROOT_DIR :- Apply changes in the CHROOT_DIR directory
and use the configuration files from the CHROOT_DIR directory.
3) -P, --prefix PREFIX_DIR :- Apply changes in the PREFIX_DIR directory
and use the configuration files from the PREFIX_DIR directory.

60.adduser
Description: Add a user to the system
Syntax: adduser [options]
Options:
1) --disabled-login :- The user won't be able to use her account until the
password is set.
2) --help :- Display brief instructions.
61.userdel
Description: Deletes a user account and related files.
Syntax: userdel [options] LOGIN
Options:
1) -f, --force :- This option forces the removal of the user account.
2) -r, --remove :- Files in the user's home directory will be removed along with
the home directory itself and the user's mail spool.

62.grep:
Description: print lines that match patterns
Syntax: grep [OPTION...] PATTERNS [FILE...]
Options:
-E, --extended-regexp(Interpret PATTERNS as extended regular expressions)

63. comm
Description: comm compare two sorted files line by line and write to standard output;
the
lines that are common and the lines that are unique.
Syntax: comm [OPTION]... FILE1 FILE2
Options:
38-p use a default value for PATH that is guaranteed to find all of the standard utilities
-v print a description of COMMAND similar to the `type' builtin
-V print a more verbose description of each COMMAND
64.rmdir:
Description: remove empty directories
Syntax: rmdir [OPTION] DIRECTORY
Options:
-p, --parents(remove DIRECTORY and its ancestors; e.g., 'rmdir -p a/b/c' is similar to
'rmdir a/b/c a/b a')
-v, --verbose (output a diagnostic for every directory processed)

65.service
Description: Provide information on registered system services.
Syntax: service status/start/stop
Options:
service --status-all
service --help|-h|-- version

66.iptables
Description: Iptables is used to set up, maintain, and inspect the tables of IP packet filter
rules in the Linux kernel.
Syntax: iptables [cmnd]
Options:
--append -A chain
Append to chain
--check -C chain
Check for the existence of a rule
--delete -D chain
Delete matching rule from chain
67.Ncdu
Description: A Command utility is a cursor based version of ‘du’, this command is used
to analyze disk space occupied by various directories.
Syntax: ncdu

68.chmod :
Description: chmod stands for "change mode." It restricts the way a file can be accessed.
Syntax: chmod [OPTIONS] MODE FILE
Options:
-c, --changes (like verbose but report
only when a change is made)
-R, --recursive (change files and directories recursively)

69.rm:
Description: The rm command is used to remove directory or files. Like use rm -r
/tmp/backup to remove everything that folder
Syntax: rm [OPTION][FILE]
Options:
-f, --force(ignore nonexistent files and arguments, never prompt)
-i (prompt before every removal)
70.mv:
Description: The mv command is used to move or rename directories and files.
Syntax:mv [OPTION]... [-T] SOURCE DEST
mv [OPTION]... SOURCE... DIRECTORY mv [OPTION]... -t DIRECTORY
SOURCE...
Options:
-n, --no-clobber (do not overwrite an existing file)
-u, --update (move only when the SOURCE file is newer than the destination file or when
the destination file is missing)

71.zcat:
Description: zcat uncompresses either a list of files on the command line or its standard
input and writes the uncompressed data on standard output.
Syntax: zcat [ -fhLV ] [ name ]
Options:
-V –version(Version. Display the version number and compilation options then q

72.vi
Description: Used to open file in Vim editor
Syntax: vi <filename>
Options:
-v
Vi mode (like "vi")
-e
Ex mode (like "ex")
-E
Improved Ex mode
-s
Silent (batch) mode (only for "ex")
-d
Diff mode (like "vimdiff")
-y
Easy mode (like "evim", modeless)
-R
Readonly mode (like "view")
-Z
Restricted mode (like "rvim")
-m
Modifications (writing files) not allowed
-M
Modifications in text not allowed
-b
Binary mode
73.aptitude:
Description: aptitude command in Linux package system opens up a highly built-in
interface to interact with the package manager of the machine. It is the control panel of
programs and packages in Windows. You can install, upgrade and remove your packages
using this well-built interface.
Syntax: aptitude [<options>...] {autoclean | clean | forget-new | keep-all |
update}
options:1.aptitude [<options>...] search <patterns>...

aptitude [<options>...] {add-user-tag | remove-user-tag} <tag> <packages>...


74.stty
Description: change and print terminal line settings
Syntax: stty [-F DEVICE | --file=DEVICE] [SETTING]..
Options:
-a, --all
print all current settings in human-readable form
-g, --save
print all current settings in a stty-readable form
-F, --file=DEVICE open and use the specified DEVICE instead of stdin

75.fc:
Description: views, edits, and executes commands for the history list. This is a shell
builtin.
Syntax:none
options:none

76.less:
Description: The less command allows you to view files without opening an editor. It’s
faster to use, and there’s no chance of you inadvertently modifying the file.
Syntax:less[options]file
Options:
-c or --clear-screen()Causes full screen repaints to be painted from the top line down. By
default, full screen repaints are done by scrolling from the bottom of the screen.
77.info
Description: read Info documents
Syntax: info [OPTION][MENU-ITEM...]
Options:
-a, --all(use all matching manuals)
-d, --directory=DIR(add DIR to INFOPATH)

78.awk
Description: The AWK language is useful for manipulation of data files, text retrieval
and processing, and for prototyping and experimenting with algorithms.
Syntax: mawk [-W option] [-F value] [-v var=value] [--] 'program text' [file ...]
Options:
-F value
sets the field separator, FS, to value.
-f file
Program text is read from file instead of from the command line. Multiple -f
options are allowed.
-v var=value assigns value to program variable var.

79.fmt
Description: Reformat each paragraph in the FILE(s), writing to standard output.
Syntax: fmt [-WIDTH] [OPTION]... [FILE]...
Options:
-c preserve indentation of first two lines
-s split long lines, but do not refill
-t indentation of first line different from second
-u one space between words, two after sentences

80.nano:
Description: This command opens nano editor.
Syntax: nano
Options: none

81.zmore
Description: file perusal filter for crt viewing of compressed text
Syntax: zmore [ name ... ]
Options:
i
display i more lines, (or another screenful if no argument is given)
^D
display 11 more lines (a ‘‘scroll’’). If i is given, then the scroll size is set to i.
82.zcmp
Description: compare two or more compressed zip files
Syntax: zcmp [ cmp_options ] file1 [ file2 ]
Options:
-b
print differing bytes
-i
skip first SKIP bytes of both inputs
-l
output byte numbers and differing byte values
-n
compare at most LIMIT bytes

83.arch
Description: print machine hardware name (same as uname -m)
Syntax: arch [options]..
Options:
--help display this help and exit
--version output version information and exit

84.umask
Description: set file mode creation mask
Syntax: umask [-p] [-S] [mode]
Options:
-p if MODE is omitted, output in a form that may be reused as input
-S makes the output symbolic; otherwise an octal number is output
85.dirname
Description: Output each NAME with its last non-slash component and trailing slashes
removed
Syntax: dirname [OPTION] NAME...
Options:
-z, --zero end each output line with NUL, not newline
--help display this help and exit
--version output version information and exit

86.printenv
Description: Print the values of the specified environment VARIABLE(s).
Syntax: printenv [OPTION]... [VARIABLE]...
Options:
-0, --null end each output line with NUL, not newline
--help display this help and exit
--version output version information and exit

87.ed
Description: ed is a line-oriented text editor. It is used to create, display, modify and
otherwise manipulate text files
Syntax: ed [options] [file]
Options:
-h, --help
display this help and exit
-V, --version
output version information and exit-G,
--traditional
run in compatibility mode
-l, --loose-exit-status exit with 0 status even if a command fails
-p, --prompt=STRING
use STRING as an interactive prompt

88.aspell:
Description: aspell command is used as a spell checker in Linux.
Syntax: aspell check [options] filename
• Options: -a : To check individual words.
• -c : Check a file for specific error.
• -mode=mode : The modes we have to use when checking files.
89.sync:
Description: Synchronize cached writes to persistent storage
Syntax: sync [OPTION] [FILE]
Options:
-d, --data(sync only file data, no unneeded metadata)

90.117.dstat
Description: A combined and flexible tool which can be used to monitor memory,
process, network or disk space performance, it is a good replacement of ifstat, iostat,
dmstat etc.
Syntax: dstat
Options:
-c, --cpu
enable cpu stats
-d, --disk
enable disk stats
-g, --page
enable page stats
-i, --int
enable interrupt stats
91.saidar
Description: Another cli based system statistics monitoring tool, provide information
about disk uses, network, memory, swap etc.
Syntax: saidar

92.ss
Description: ss or socket statistics is a good alternative to netstat it directory gather
information from kernel space nad play fast in comparision to the netstat utility
Syntax: ss
93.Ccze
Description: A tool that decorate your logs
Syntax: ccze
94.chown
Description: Linux chown command is used to change a file's ownership, directory, or
symbolic link for a user or group.
Syntax: chown [OPTION]... [OWNER][:[GROUP]] FILE...
Options:
1)-R, --recursive: It is used to perform operations on files and directories recursively
2)--help: It is used to display the help manual having a brief description of the usage and
options.
3)--version: It is used to display the version information

95.tee
Description: Linux tee command is quite similar to the 'cat' command, with only one
difference. It puts stdin on stdout and also put them into a file.
Syntax: tee <options> <file name>
Options:
1)-a, --append: It is used to append the data to the given files, it does not overwrite data.
2)-i, --ignore-interrupts: It is used to ignore the interrupt signals

96.od
Description: The 'od' term stands for octal dump. It displays content of a file in different
human-readable formats like hexadecimal, octal and ASCII characters.
Syntax: od <option><fileName>
Options:
od -b <fileName> (display files in octal format)
od -t x1 <fileName>
(display files in hexadecimal bytes format)
od -c <fileName> (display files in ASCII (backslashed) character format)

97.fg
Description: It is used to run a stopped process in the foreground.
Syntax: fg jobname
98.sleep:
Description: delay for a specified amount of time
Syntax: sleep NUMBER[SUFFIX]
Options:
--help display this help and exit
--version output version information and exit.

99.mount:
Description: This command is used to get information about mounted devices.
Syntax: mount [-l|-h|-V]
Options:
-i, --internal-only(Don't call the /sbin/mount.filesystem helper even if it exists.)

100.tty:
Description: Displays the current terminal
Syntax: tty [OPTION]
Options:
-s, --silent, --quiet(print nothing, only return an exit status)
--version(output version information and exit)

Conclusion:

Hence we learned 100 linux commands on linux terminal which can be used for
various like file management, process management and memory management.

You might also like