0% found this document useful (0 votes)
2 views

unix-lab1

The document provides an overview of basic UNIX commands, detailing their functions and examples of usage. It highlights the importance of UNIX as a multi-tasking, multi-user operating system developed in the 1970s, which is essential for server operations and testing. A list of commands such as 'man', 'who', 'cat', and 'chmod' is included, along with descriptions and examples for each command.

Uploaded by

mravi99498
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

unix-lab1

The document provides an overview of basic UNIX commands, detailing their functions and examples of usage. It highlights the importance of UNIX as a multi-tasking, multi-user operating system developed in the 1970s, which is essential for server operations and testing. A list of commands such as 'man', 'who', 'cat', and 'chmod' is included, along with descriptions and examples for each command.

Uploaded by

mravi99498
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Experiment -1

Practicing of Basic UNIX Commands.

What is Unix Command?

The below article gives an overview of Unix commands. An OS providing both


command line interface (CLI) and graphical user interface (GUI) based
interaction integrated by Dennis Ritchie, Douglas Mcllroy, Joe Ossanna Brian
Kernighan, and Ken Thompson at Bell laboratory in 1970 called a multi-tasking
operating system permitting two or more users to simultaneously operate on the
operating system and offers commands for the users for interacting with the
application from command line interface, such as sudo command, chmod
command, su command, mv command, rm command, vi command, cat
command, rmdir command, mkdir command, clear command, and ls command,
which can be used to implement complex tasks.

Introduction to Unix

Unix is an OS that provides both CLI and GUI-based interaction. It was


developed by Dennis Ritchie in the C language. Unix operating system is
multitasking, which also gives an opportunity for two or more users to use its
benefits. In other words, it is a multi-user OS. Ubuntu OS is a Unix version that
enables us to do every work that Unix is supposed to do.

Hence, it's recommended by professionals who operate with servers; it's also
recommended to learn how the command-line-based operating system works.
Many large and complex applications that utilize Unix to execute because of its
aspect to handle the processes easily. It's a bit faster and provides a nice user
experience when compared with the Windows operating system.
Several testing activities, such as performance and installation testing,
depending on OS knowledge. Almost every web server is Unix based
nowadays. So, knowledge of Unix is essential for testers. If we are unfamiliar
with Unix, then learning Unix commands can be a great start. One of the best
ways to understand these commands is to practice and read them simultaneously
on Unix OS.

Study of Unix basic command list: man, who, cat, cd, cp, ps, ls, mv, rm, mkdir,
rmdir, echo, more, date, time, kill, history, chmod, chown, finger, pwd, cal,
logout, shutdown.

1. man - Manual pages

 Description: Displays the manual (help) page for a command.


 Example:

bash

$man ls

This will display the manual for the ls command.

2. who - Who is logged in

 Description: Displays information about the users currently logged into


the system.
 Example:

$who

Output:

user1 tty1 2024-12-25 10:00


user2 pts/1 2024-12-25 10:30
3. cat - Concatenate and display file contents

 Description: Displays the content of a file.


 Example:
$cat file.txt

This will output the content of file.txt.

4. cd - Change directory

 Description: Changes the current working directory.


 Example:

$cd /home/user

 Other uses:
o To go back to the previous directory: cd -
o To go to the home directory: cd ~

5. cp - Copy files or directories

 Description: Copies files or directories.


 Example:

cp file1.txt /home/user/backup/

 To copy directories:

cp -r directory_name /home/user/backup/
6. ps - Report process status

 Description: Displays information about active processes.


 Example:

ps aux

This lists all processes currently running on the system.

7. ls - List directory contents

 Description: Lists files and directories in the current directory.


 Example:

ls -l

This lists files with detailed information like permissions, size, and
modification time.
8. mv - Move or rename files or directories

 Description: Moves or renames files or directories.


 Example:

bash
Copy code
mv file1.txt file2.txt

 To move a file:

mv file1.txt /home/user/backup/
9. rm - Remove files or directories

 Description: Removes files or directories.


 Example:

$rm file1.txt

 To remove a directory and its contents:

$rm -r directory_name
10. mkdir - Make directories

 Description: Creates a new directory.


 Example:

$ mkdir new_directory
11. rmdir - Remove empty directories

 Description: Deletes an empty directory.


 Example:

$rmdir new_directory
12. echo - Display a line of text or variables

 Description: Prints a line of text to the terminal.


 Example:

$echo "Hello, World!"

This will print Hello, World! to the terminal.


13. more - View file contents one page at a time

 Description: Allows you to view the content of a file page by page.


 Example:

$more largefile.txt

This will display the contents of largefile.txt page by page.

14. date - Display or set system date and time

 Description: Displays the current system date and time.


 Example:

$date

Output:

Tue Dec 25 12:00:00 UTC 2024


15. time - Measure command execution time

 Description: Measures how long a command takes to execute.


 Example:

time ls

This will output the time it took to run the ls command.

16. kill - Terminate a process

 Description: Sends a signal to terminate a process.


 Example:

$kill 1234

This will terminate the process with PID 1234.

17. history - Display the command history

 Description: Displays a list of previously entered commands.


 Example:

$history
18. chmod - Change file permissions

 Description: Changes the permissions of files or directories.


 Example:

$chmod 755 file1.txt

 Explanation:
o 7 = read, write, and execute for the owner.
o 5 = read and execute for the group.
o 5 = read and execute for others.

19. chown - Change file ownership

 Description: Changes the owner and group of a file or directory.


 Example:

$chown user:group file1.txt


20. finger - User information

 Description: Displays information about a user on the system.


 Example:

$finger user1
21. pwd - Print working directory

 Description: Displays the current directory path.


 Example:

$pwd

Output:

arduino
Copy code
/home/user/Documents
22. cal - Display a calendar

 Description: Displays the current month’s calendar.


 Example:

$cal

Output:
css
Copy code
December 2024
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
30 31
23. logout - Logout from the current session

 Description: Logs out of the current user session.


 Example:

$logout
24. shutdown - Shut down or restart the system

 Description: Shuts down or restarts the system.


 Example:

$shutdown -h now

This shuts down the system immediately.

 To restart:

$shutdown -r now

You might also like