0% found this document useful (0 votes)
63 views1 page

Essential Linux Commands Practice Guide

This Linux lab assignment involves practicing various Linux commands like cd, cat, ls, mkdir, rmdir, pwd, mv, cp, chmod, find, head, more, tail, chgrp. It includes tasks like creating and moving files between directories, setting file permissions for owner, group and others, creating symbolic links, using commands to view system resources and users. The last 3 sentences provide instructions to delete empty and non-empty directories, display the operating system name, and explore calendar command options.

Uploaded by

mayande rohini
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views1 page

Essential Linux Commands Practice Guide

This Linux lab assignment involves practicing various Linux commands like cd, cat, ls, mkdir, rmdir, pwd, mv, cp, chmod, find, head, more, tail, chgrp. It includes tasks like creating and moving files between directories, setting file permissions for owner, group and others, creating symbolic links, using commands to view system resources and users. The last 3 sentences provide instructions to delete empty and non-empty directories, display the operating system name, and explore calendar command options.

Uploaded by

mayande rohini
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

LAB ASSIGNMENT ON LINUX - 2020

1. Practice all the below mentioned commands with all possible options:

cd, cat, ls, mkdir, rmdir, pwd, mv, cp

2. Create a file without using the vi or any of the GUI editors?


3. What does cd do when used without arguments?
4. Move all the files from foo directory to bar directory.

NOTE: Make a directory foo with two empty files [Link] and [Link]

Make another directory bar now move all files from foo to bar.

5. Execute the two commands echo * and ls. What do you think echo did?
6. Practice the below mentioned commands with all possible options:

chmod, find, head, more, tail & chgrp

7. Set the permissions of [Link] file to have all permissions for yourself?
8. Find out the location of the command 'service' using the suitable Linux command?
9. Create 3 files (file1 , file2, file3) & assign permissions:

– r, w to owner, group, and others for file1


- r, w to owner and group, r to others for file2
- r,x to owner, r to group, none to others for file3

10. Create a symbolic link in your current directory called ‘symlink’ to file1 created in /tmp folder
11. See the difference between cd ~ and cd - and cd.?
12. Use the cd command to go to the “root” of the file system?
13. Explore the command chown using man pages.
14. Find out how you can see what a system is running and what resources the system is using
commands ps and top?
15. How do you scroll through the past commands executed?
16. Observe how the command completion happens on tab
17. Run a Linux command to display the list of users who are currently using the Linux machine.
18. What is the Linux command to display calendar for the October month 2020. Explore different
options
19. Delete an empty directory and verify your results by using the ls command. Try deleting a
directory which is not empty and record the error message.
20. Which command is used to display the operating system name?

Common questions

Powered by AI

The 'chmod' (change mode) command is used to change the file permissions in Linux. To give all permissions (read, write, execute) to the owner of the file 'first.txt', you would use the command 'chmod 700 first.txt'. This grants the owner all permissions while removing permissions for group and others .

One way to create a file in Linux without using the vi editor or a GUI editor is by using commands such as 'touch' to create an empty file or 'echo' combined with either '>' or '>>' to create and write to a file. For example, 'touch filename' creates a new empty file, while 'echo "content" > filename' creates a file with the specified content .

To move all files from one directory to another in Linux, you can use the 'mv' command. For example, if you have a directory named 'foo' containing files and you want to move them to another directory named 'bar', you would use the command 'mv foo/* bar/'. This moves all files from the 'foo' directory to the 'bar' directory .

The 'echo *' command in Linux outputs the list of files and directories in the current directory to the screen by expanding the '*' wildcard, effectively performing a non-detailed listing. In contrast, 'ls' provides a more formatted and detailed list of the same files and directories. While 'echo *' simply echoes the contents, 'ls' may include additional information like file permissions .

To explore and learn about the 'chown' command in Linux, users can utilize 'man chown' to access the manual page, which provides a comprehensive explanation of usage, options, and examples. Additionally, 'info chown' might offer more in-depth information, and 'chown --help' gives a quick summary of command syntax and options .

Tab completion in Linux allows users to auto-complete commands or file names in the terminal by pressing the 'Tab' key. It helps reduce typing effort, minimizes errors, and improves efficiency by completing partially typed commands or file paths whenever possible. Pressing 'Tab' after partially typing a command or file name lists available completions if there's ambiguity .

In Linux, the 'ps' command can be used to display currently running processes, while 'top' provides a real-time, dynamic view of system processes and resource usage such as CPU and memory. Using 'ps aux' lists all processes with their details, and running 'top' offers continuous updates on system performance .

You can use the 'which' command to find the location of the command 'service' in a Linux system by executing 'which service'. This command returns the path where the 'service' command is located .

A symbolic link in Linux is created using the 'ln -s' command. For example, you can create a symbolic link named 'symlink' to a file 'file1' located in the '/tmp' directory by executing 'ln -s /tmp/file1 symlink'. Symbolic links serve as pointers or references to the target file or directory, allowing users to access the file using the link path .

The command 'cd ~' takes the user to their home directory, 'cd -' switches the user to their last working directory, and 'cd .' keeps the user in the current directory. These commands serve different navigational purposes depending on where the user needs to be in the file system .

You might also like