Professional Documents
Culture Documents
(BCSF19M025-LAB3)
Windows Commands:
Attrib command:
Attrib command is used to display, set or remove assigned attributes of files or directories. If used
without any parameters it displays the current attributes of the files of the current directory.
+ive sign sets the attribute while -ive sign clears the attribute. r, a, s, h and i are attributes.
Let’s apply a attribute to file2.txt in the above files. Execute the following command:
attrib +r file2.txt
To remove the attribute use -ive sign with the same attribute and it will remove it.
attrib -r file2.txt
/s Parameter: Applies attrib and any parameter to matching files in the current directory
and all of its subdirectories.
/d Parameter: Applies attrib to directories.
/l Parameter: Applies attrib to the Symbolic Link, rather than the target of the Symbolic Link.
Chdir Command:
Displays the name or changes of current directory. If used with a drive letter, chdir displays the name
of current directory in the specified drive. Without any parameters it displays the name of current
directory in current drive.
Color Command:
Changes the foreground and the background color of windows command prompt for the current
session. If used without any parameter, it restores the default color of the command prompt.
The first character is for the color of the background and the second character is for the color of
foreground text.
Below are some character values for the colors.
Values Color
0 Black
1 Blue
2 Green
3 Aqua
4 Red
5 Purple
6 Yellow
7 White
8 Gray
9 Light Blue
A Light Green
B Light Aqua
C Light Red
D Light Purple
E Light Yellow
F Bright White
Using the following command Yellow is set as a background color and blue is set as foreground color:
Exit Command:
This command is used to exit the command interpreter/prompt.
Find Command:
This command is used to search for a string of text in a file or files and display lines of text that
contain the specified string.
Let’s consider 2 files [“file1.txt” and “file2.txt”] inside a folder named os. Let’s find if there is pucit
word in file1.txt.
As you can see, it prints out the lines with pucit in file1.txt by default.
To find the number of lines that don’t contain the specified string “pucit” in file1.txt.
Or you can type the name of command after help to get help about a certain command. Figure
below provides a detailed description of the exit command.
Help | more Command:
Using a pipe help command’s output is redirected to the more command which limits the output of
the help command to Command prompt page length.
You can press enter to display the next line of the help command’s output or press Ctrl + C to exit.
mklink Command:
This command creates a symbolic or hard link of a directory or file.
Hard Link: Hard links point, or reference, to a specific space on the hard drive. If a file/directory has
two hard links, even if one hard link is deleted the file/directory can still be accessed by the other
hard link.
Soft Link: A symbolic link, also termed a soft link or symlink, is a special kind of file that points to
another file. It is like a shortcut in Windows. If the hard Link or the original file is deleted, soft link
will not work as it points to the file not the memory.
Consider the structure as follows:
By using the mklink command a soft link is created inside folder1 for file1.txt.
Consider the following file with names, it can be sorted Alphabetically using the sort command.
Some Examples:
Linux Commands:
ls Command:
It's used to display a list of files and sub-directories in the current directory.
Whoami Command:
The whoami command is a compound of the words “Who am I?” and prints the name of the user
associated with the current effective user ID. In other words, it displays the name of the currently
logged-in user.
pwd Command:
This command is used to display the present working directory. It prints the path starting from the
root to the present working directory.
Bin directory: Bin folder contains the programs essential for the system to boot and run. It
stores the binary executables of programs.
/dev directory: All devices such as USB, disks, cpu etc., are contained by this directory.
/home directory: This directory contains home directories of each regular users on the linux
operating system.
/lib directory: This directory contains libraries required by programs in /bin.
/opt directory: This directory contains optional software such as dropbox, clion etc.
/proc Directory: This directory contains information and data of processes in the system.
Everything in linux is a file, even processes.
/root directory: This directory is home for the root user. Do not mix it with the root
directory which is (/).
/usr directory: This directory contains programs and libraries used by a regular user.
Paths and Wild cards Revisited
Paths:
A path in Linux is same as a real-life path. Path is a way to reach some location. This location can be a
folder/file or a city.
There are two basic types of paths: relative paths and absolute paths. A relative path is the location
of a file/directory relative to the current directory. The current directory is the directory in which the
user is currently working. While absolute path is the location of a file/directory relative to root
directory.
Wildcards:
Wildcards or wildcard character is a symbol used to replace or represent one or more characters.
The most common wildcards are the asterisk (*), which represents one or more characters, and
question mark (?), which represents a single character. They can be used in a number of ways on
terminal.
mkdir Command:
mkdir command is used to create a directory.
cd Command:
cd command also known as change directory command is used to change directory in command-line
shell.
Cat Command:
Cat command is used to print the content of a file to the standard output stream.
When used without any parameter it takes input from standard input and outputs it to standard
output.
Virtual box installation
1. Click on the Add button
2. Add the iso image of ubuntu and change the folder if you want.
5. Create a new virtual hard disk and allot minimum of 15GB, you can allot higher Disk Space if
you want.
Process:
1. Type Disk Management in search and open this or press Ctrl + X and select Disk
Management.
2. Select any volume you have space available and shrink it. Select a volume that has extra
space that you don’t require.
3. Enter how much you want to shrink the volume in MBs. Remember this space will become
unusable for windows until you have ubuntu installed. So, select carefully.
Note: Recommended minimum size for installation is at least 25-30GB.
4. Now, open rufus, select your USB device, the ISO file of ubuntu you downloaded earlier and
start the process.
5. Once finished, restart your laptop/Computer with the USB plugged in, open boot menu using
one of the function keys as displayed on the screen (These are different for different devices
but usually F11 or F12) to boot from USB.
6. Once you have booted through the USB, you’ll be presented with this menu. Click install
ubuntu.
11. The following popup will appear. Use all free space in size and choose mount point as “/”
and click ok.
12. After this select the newly created ext4 partition and click Install Now. The selected partition
will be colored after you click on the partition.
Note: There are several ways of installing ubuntu. We will be following the easiest one.
DO NOT CHANGE THE “DEVICE FOR BOOT LOADER INSTALLATION:”
13. Select your country and press continue, the installation will begin.
Disclaimer:
When uninstalling ubuntu you must find an online guide. Deleting ubuntu partition might lead to
grub issues.