Command Line Course
Linux Task
- Restart MySQL service using Terminal (Information about controlling services can be found here.
Try All methods described in the document. - Use a command to show the current working directory, and list the directory contents with and without hidden files, and in the short and long format.
- Change the Password of your account to wisdmlabs using terminal
- Create a user named wdm with password wisdmlabs with account expiry date as 6 February 2021. Add this user to group www-data
- Make a directory called WDMLINUX and change the current working directory to the new directory.
- In the WDMLINUX directory create a new folder called A1 and A2.
- List the folders, then remove the A2 directory and list the folders again to show that it is no longer present.
- Display the manpage for
ls, but redirect the output into temp.txt, then use thecat,less, andmorecommands to display the new file. - Display the initial 10 lines and final 5 lines of temp.txt with the obvious Linux commands.
- Change the working directory to A1 and use
geditfrom the command line to create A1.header with the following personal information:- Name:
- Email:
- Date:
- Exit gedit and copy the new file A1.header to A1.backup. Verify that both files exist by listing the directory.
- Use a command to show the difference between the files, then edit A1.backup and change one line, then run the difference command again.
- Rename the A1.backup file to A1.old, then list the directory, and remove the A1.old file, and list the directory again.
- List the directory with a long format, then toggle the group read protections on the A1.header file. List the directory again to verify the protection has changed.
- Show the processes currently running, and pipe the output to grep, matching only processes owned by root.
- Start gedit from the launcher, not the command line, then terminate the process using the command line, and verify that it goes away. Be careful!
- Get the system date and time, then repeat the same command using the timing command to find out how long the command takes to execute.
- Ask the system where the
mkdircommand is found in the filesystem, and do a listing of that directory to see the commands that reside there. - Find out the list of all software tools installed. Pipe the contents of the command to
lessand find out the version of installed apache in the output you see. - Perform the above task again but instead of piping content to
lesscommand, pipe it tomorecommand. - Redirect the output of the
echocommand to a file and examine the file to make sure it contains the string you asked the system to echo. - Use the
historycommand to display the last 20 commands you typed into the terminal window. - Search for the last instance of the
mkdircommand using the history search mechanism described in the slides. - Use
ifconfigcommand in terminal window to show your network configuration - Use the
pingcommand to ping your colleague. (Ask your colleague for his/her IP address) - Find out the IP address of wisdmlabs.com (Do not use
pingcommand.) - Enable Firewall on your computer. Search on the uncomplicated firewall for Ubuntu. Enable Port 32 on your computer. Check if the port is opened. After confirming that, close the port.
- Search for ports opened on server hosting the website wisdmlabs.mirealux.com
- Find out your current IP from
ipcommand (ifconfigwas deprecated in the year 2012 and was removed in the Ubuntu 18. Use ip instead ). Note it down. Stop your networking service. Set this IP address as static IP address in your computer using the terminal.
You can use 255.255.255.0 as netmask and 192.168.2.1 as gateway while setting the static IP address. Once it is set, start the networking service again.
Check if your IP address is set correctly by firingifconfigcommand. Discuss with your mentor first before trying this command, as it can create problems with networking. - Find all .sh files on your computer. (Study locate and find command)
- Find out information about Processor and RAM.
- Display list of all open ports on your own system
- Study top command and try different parameters that can be passed to top command.
- Download https://wordpress.org/latest.zip file in /var/www/html directory. Unzip the downloaded zipped file. It will create a new folder named ‘wordpress’ and unzip in that directory.
cdto the directory wordpress and search for all files which contain the string ‘do_action’.- Create a new file named ‘robots.txt’ in wordpress directory. Edit that file using vim command and add the following content in that file: User-agent: *
Allow: / Save the file. Check the content of the file using less command. Fire a command in terminal which will replace Allow with Disallow in robots.txt. Confirm that replacement has been taken place by viewing the content of that file using cat command.
- Change permission of all files in that wordpress directory to 644 and all folders to 755
- Change owner and group of all files and folders in that wordpress directory to www-data.
- wordpress directory contains the file readme.html. Make that file blank.
- Create a zip file which should contain wp-admin folder, wp-config.php, xmlrpc.php, wp-cron.php and robots.txt files. Name of that folder should be wp-sample.zip
- Type CTRL-D to terminate logging, and move A1.log from the home directory to the A1 folder.
- Copy the personal information from A1.header to the top of the A1.log file, using any editor that you would like.