If you can see this check that

Main Page

Linux in Windows


Essentials

User:
Password:

Session 1

Basic usage of linux within Windows, using cygwin.

Boot with Windows 7.

To reset all the check buttons from a previous attempt click here

Question 1: Access

Start up a VNC connection to your Windows 7 virtual machine, then using the Start menu navigate to All Programs / Cygwin / Cygwin Bash Shell. You should now have the bash Cygwin prompt.

Tests - not attempted
Running a terminal UNTESTED

Question 2: Create and Navigate Directories

The "cd" command changes your current directory. On its own it changes it to your HOME directory, otherwise you need to specify a parameter which either is an absolute directory (such as cd /home) or a relative directory (such as cd dir1 which takes you to dir1 in your current working directory).

Type

cd
pwd
This will take you to your home directory and then Print Working Directory.

What is your current working directory? :

Tests - not attempted
Correct cwd UNTESTED

Make three directories in your HOME directory. Name these directories "mydir", "data", and "images".

Tests - not attempted
Three directories created UNTESTED

Change your working directory into "data". Create two more directories in /home/caine/data called "dir1" and "dir2". If you create them in the wrong place delete them using "rmdir".

Tests - not attempted
Two directories created UNTESTED
Not accidentally created in HOME UNTESTED

Change directory into dir2.

What is your current working directory? :

Tests - not attempted
Correct cwd UNTESTED

Change your current working directory to HOME. You can either "cd" (takes you home) or "cd .." as needed, as ".." means the directory above the current directory in your directory tree. Check with pwd to make sure you are in the right directory. Then try to delete the data directory using "rmdir data". What message to you get back?

Tests - not attempted
Error message displayed UNTESTED

Use the more powerful and dangerous command

rm -rf data
This deletes all files and directories in the data directory, including the data directory itself. Obviously getting the parameter wrong means you can lose a lot of stuff in one go!

Tests - not attempted
Two directories left... UNTESTED

Question 3: The ls command

The "ls" command on its own shows you the contents of the current working directory. However it can also take a number of useful parameters.

Filenames which begin with a "." character do not usually appear when you use "ls". These are called "hidden" files, and they are used for things like application configuration and some GUI state information. They are rarely needed so this is the reason they are hidden from normal "ls".

Use the option "-a" to see the hidden files. View the hidden files in your HOME directory. The file list starts with "." (which is a directory that you can use to describe the current directory in commands) and ".." (which describes the directory above this one in the tree).

What is the first file (in alphabetical order) which appears when you use "-a" in your HOME directory, other than "." and "..". :

Tests - not attempted
Third file when using -a UNTESTED

Use the "-l" option to see a long listing of the .bash_profile file. Identify its size in bytes. This size appears before the creation date. :

Tests - not attempted
Size of file UNTESTED

Question 4: Redirection

The following command, echo, simply prints to the screen its parameters.

echo "line 1: test" 
You can redirect a command to a file, so that "line 1: test" appears in the file rather than on the screen.
echo "line 1: test" > outfile1
You can "cat outfile1" to see that it has worked.

Tests - not attempted
file exists in the right place UNTESTED
Contents look right UNTESTED

Question 5: append

Copy the outfile1 file to outfile2, and then append to that file the current date and time.

date >> outfile2

Tests - not attempted
outfile exists in the right place UNTESTED
The outfile1 appears to be first UNTESTED
The date appears to be last UNTESTED

Question 6: copying

Copy the file outfile1 to yearfile2. Copy the file outfile1 to yearfile3.

Tests - not attempted
outfile1 copied to yearfile2 UNTESTED
outfile1 copied to yearfile3 UNTESTED

Question 7: moving

Change the name of file yearfile3 to thisyear.

Tests - not attempted
Name changed from yearfile3 to thisyear UNTESTED
File outfile1 unharmed UNTESTED

Question 8: deleting

Delete the file outfile1.

Tests - not attempted
outfile1 has been deleted UNTESTED

Question 9: big concat

Concatinate the files "outfile2", "thisyear" together to form a single big file called "bigfile". Check that your command worked using cat.

Tests - not attempted
bigfile is a concat of 2 files in order UNTESTED


Centos 7 intro: Paths | BasicShell | Search
Linux tutorials: intro1 intro2 wildcard permission pipe vi essential admin net SELinux1 SELinux2 fwall DNS diag Apache1 Apache2 log Mail
Caine 9.0: Essentials | Basic | Search | SysIntro | 5a | 5b | 5c | 6 | 7a | 7b | 8a | 8b | Browser
CPD: Cygwin | Paths | Files and head/tail | Find and regex | Sort | Log Analysis
Kali: 1a | 1b | 1c | 2 | 3 | 4a | 4b | 5 | 6 | 7a | 8a | 8b | 9 | 10 |
Useful: Quiz | Forums | Privacy Policy | Terms and Conditions
Site Links:XMLZoo ActiveSQL ProgZoo SQLZoo

Linuxzoo created by Gordon Russell.
@ Copyright 2004-2018 Edinburgh Napier University