I will use Kali Linux to demonstrate the basics of the Linux operating system. By using the Kali Linux command line, I will explore the Linux file system to shed light on the file structure. Furthermore, I will execute basic Linux commands and illustrate fundamental file permissions.
– Windows 10 64x
– At least 2 GB of RAM
– VMware Workstation 12 Player
– Kali Linux Virtual Disk File
Begin the lab by booting into Windows 10 and starting VMware Workstation 12 Player. In VMware Workstation 12 Player, open a virtual machine using a Kali Linux Virtual Disk File. Then, use the username “root” and the password “toor” to log in. Afterward, open a terminal via the left toolbar. The terminal serves as the command line used for the rest of the lab.
The second phase of the lab explores basic commands used for directory exploration. Use the command “pwd”* to produce a feed of the working directory. On startup, the working directory should come out as “root.” To change the directory to the root directory, enter “cd /.” The command “cd” represents “change directory”, while the target “/” represents the root directory. To access a feed of the root directory, enter “ls.” To specify the desired directory, enter the directory’s name after the command. For example, to list the home directory, enter “ls /home.” Then, move to the come directory by entering “cd ~.” From here, print the working directory with the “ls” command. Afterward, move up a folder to explore the contents by entering “cd ..” and then entering “ls.”
The next phase demonstrates different commands common to Linux systems. First, enter “man ls” to see the manual for the “ls” command. To exit out of the manual, press “q.” To see every file in the home directory, enter “cd~”, then enter “ls –a.” Afterward, use the CTRL + C interrupt by entering “yes please” and pressing CTRL +C. Then, to view the contents of a file, enter the command “cat”, followed by the name of the file. For example, the command “cat ~/.bashrc” prints out the contents of the bashrc file. To print the contents in detail or in truncated form, use the “more” or “less” command respectively. For instance, enter “more ~/.bashrc” to yield a more verbose output. In the aftermath, enter “clear” to clear the terminal of data and start fresh. Enter the “head” or “tail” command to view the first or last 10 lines of a file, respectively. For example, “head ~/.bashrc” tells you the first lines of the bashrc file.
The third phase involves the creation and alteration of directories and files. First, to make a new file, use the “mkdir” command. For example, enter “mkdir EMPTY” to make a directory called “EMTPY.” Next, use enter “rmdir EMPTY” to delete the new “EMPTY” directory. To create a new file, use the “touch” command. For example, entering “touch EMPTY-FILE” creates a file called “EMPTY-FILE.” To delete the new file, enter “rm EMPTY-FILE.” Making a directory full of files can be accomplished with successive commands. For instance, enter the commands “mkdir UCI”, followed by “touch UCI/HW-1.txt” and “touch UCI/LAB-2.txt” to create a directory with txt files in it. The “rmdir” command will not work on this directory. Instead, use the –r flag by entering “rm –r UCI.” To copy a file, use the “cp” command. For example, enter “cp A.txt foldername” after these objects have been created to copy the file to the folder. To copy and rename the .txt file, enter the command “cp A.txt foldername/B.txt.” Furthermore, to copy an enter folder, use the –r flag by entering “cp –r foldername foldername2.” To move a file, use the “mv” command by creating a file with “touch C.txt” and moving it with “mv C.txt foldername.” Finally, to rename the file while moving it, enter “mv C.txt D.txt.”
The third phase includes the usage of more complex commands. To execute two commands at once, use a semicolon. For instance, entering “cd ..;ls” will move the user up 2 directories and list the contents of the directory. Furthermore, to designate all the files with a command, use an asterisk. For example, enter “ls foldername/*.txt” to list all the .txt files in the folder. To save the output of a command, use the standard output character: “>.” Enter “echo ‘Hello, Standard Output!’ > Hello-Standard-Output.txt” to save an echo. Moreover, use the pipe command with “|” to direct the output of one command to the input of another. Enter “ls –la /etc | less” to stream the left command to the right command.
The final phase involves security commands and permissions. To change a user’s password, enter “passwd.” To view what account is logged in, enter “whoami.” Furthermore to see what group the user belongs to, enter “id.” To create a user, ender “adduser” followed by the username of the new user. Additionally, a user can log into another account by entering “su”, followed by the username. Moreover, file permissions of directory files can be viewed by entering “ls –la.” To view permissions of individual files, enter “ls –l” followed by the name of the file. In addition, “chmod u+x”, followed by the file name, will add executable permissions for the user. To remove group permissions, enter “chmod r-g A.txt”, followed by the file name. To comprehensively change the permission of a file, change the octal values with the “chmod” command. For instance, “chmod 666”, followed by the file name, gives read and write permissions to everyone. “6” represents read and write permissions, the first figure represents the permissions of the owner, the second figure represents the permission of the group, and the third figure represents the permissions of everyone else. To edit a file, enter the “vi” command. For instance, “vi Hello-vi.txt” will allow the user to edit the Hello-vi.txt document. The “nano” command also serves as a way to edit files.
*Commands should be entered without quotes.
Screenshot 1: List of the root directory yielded by the “ls” command.
Screenshot 2: First manual page yielded by the “man” command. Note: 9 screenshots cover the entirety of the manual.
Screenshot 3: Files listed in the home directory.
Screenshot 4: Files listed in the newly created folder.
Screenshot 5: All “.png” files listed in the newly created folder.
Screenshot 6: Listing the “/home” directory after adding new user. Note: a new folder for the new user has been created.
Screenshot 7: Screenshot when logged in as new user. Note: the whoami command and id command verify that the new account is logged in.
Screenshot 8: Listing files in the home directory as new user.
Screenshot 8: Typing “Hello World!” via the “vi” command.
Screenshot 10: Typing “Hello World!” with the nano command.
Linux offers crisp user functionality with useful commands and directory design. By executing specific commands in the terminal, the user can add or remove files, folders, directories, and accounts. Furthermore, Linux provides commands that allow the user to manage inputs and outputs by redirecting them toward different processes. Moreover, Linux possesses a permissions system that grants the user access control on a detailed level. Additionally, other Linux commands exist to guide the user with manuals and content lists.