Sample Practical

Hello
Today I had a beautiful test to write some commands using Ubuntu, now I want to make sure of my answers to be reassured, if I had a mistake please correct me

  1. List all files details under ubuntu Desktop.

my answer:

cd Desktop |ls -l
  1. Navigate to your Desktop directory and write down the full path.

my answer:

pwd
  1. Create a directory under /home/ubuntu name the directory quiz.

my answer:


home@ubuntu:~$ mkdir ubuntu

home@ubuntu:~$ cd ubuntu

home@ubuntu:~/ubuntu$ mkdir quiz

home@ubuntu:~/ubuntu$ ls
quiz

home@ubuntu:~/ubuntu$ pwd

/home/home/ubuntu
  1. List all files which contain the letter p and redirect the output to a file under your quiz directory.

my answer:

ls p* > quiz
  1. Use grep command to extract the word time from ls manual and save the output to a file under your quiz directory.

my answer:

grep -t > quiz
  1. What does ls om*.su? do? Give an example for the output.

my answer:

list all files which content first letter o and second letter m and any letter in thread and have extension .su
  1. Student.txt file contains information about students which includes student Id,Student Name, subject, and Grade
04152:Jhon : COMP222:2 .5
04152:Smath : COMP222:3  
0123:Sara: COMP222:3
03234:Lea: COMP222:2.5

From this file use linux command extract student number and grade and save this information in a new file grade.txt

my answer:

cp Student.txt > grade.txt

[quote=chirel;302524109]

Hi,

Please could you read the rule 6 of the Rules here.

Sorry but in my opinion look like you fail the test.

If you want comments , please edit your original post and re-format the post using [code] tags for code and data sample and correct the

[list]
tags.

Why do you think that? : (

The best way to learn! error! Even learn right and wrong.

  • text ls ~/Desktop
  • text cd ~/Desktop && pwd
  • text mkdir -p /home/ubuntu/quiz
  • text ls *p* > /home/ubuntu/quiz/file
  • text man ls | grep time > /home/ubuntu/quiz/ls.man.section
  • List all files beginning with om AND ending with .su
  • text awk -F: '{$0=$1 FS $NF}1' Student.txt > grade.txt

From here you can take the time to study each solution and you can search the forum for similar solution or read the manual for each command.

home@ubuntu:~/Desktop$ mkdir -p /home/ubuntu/quiz
mkdir: cannot create directory `/home/ubuntu': Permission denied
home@ubuntu:~/Desktop$ 

Still not working with the following ?

mkdir -p "$HOME/quiz"

You can try

sudo mkdir -p /home/ubuntu/quiz

since your user don't have write permission on /home/ubuntu or /home