tut 2 Flashcards

1
Q

ls -atouch test.txt

A

creates a file called “test.txt”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

man ls

A

shows all the ls commands

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

ls -a or ls -a -1

A

shows all the hidden entries (files)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

ls -1

A

lists down all the files in a single line/single entry

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

ls -1 | wc -l

A

shows all the files in the directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

ls -1a | wc -l

A

shows all the files + the hidden files in the directory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

ls -a1R

A

shows all the content in the sub directories also

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

mkdir -newdir

A

makes a new directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

mkdir -newdir
touch -file1
ls

A

creates a new file called “file1” under “newdir” and ls lets us see the new file under the new directory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

mkdir -newdir
touch -file1
ls
echo “hello world”&raquo_space; file1
cat file1

A

output: hello world

this script creates a new file in the new directory and adds in a sentence called “hello world”, using the cat command helps us to see the content in file1.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

cp file1 file2

A

copies content from file1 to file2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

mv file1 file3
ls

A

output: file2 file 3
(ls replaces the file1 with file3)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

mv file3 ..

A

file 3 is moved to the parent directory, as known as desktop (moves 1 level up)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

mv file3 ..
ls
ls /home/ict246/Desktop
OR
ls ~/Desktop
OR
ls ..

A

ls just shows the list of files in the current directory, so the output is file2

the last command tells us the list of files in the Desktop so file3 is included in the list of files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

mv ../file3
ls

A

this moves file3 from the desktop to the current directory user is working in.

output: file2 file3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

cd ..

A

helps us to get out of the new directory we added recently and brings us back to the desktop directory we were originally working in.

17
Q

rmdir new-dir

A

helps to remove the directory “new-dir”. if the directory cant be removed it is because there are still files inside that “new-dir”

18
Q

rm -r new-dir/

A

removes the directory and the files inside immediately and its irreversible.

19
Q

touch a{1..5}

A

adds in filea1, filea2, … filea5 in the current directory.

20
Q

ls *

A

shows all the files in the current directory, and lists down the sub directories in a single line, similar to ls -1

21
Q

ls a*

A

shows all the files that starts with “a”

22
Q

ls *a

A

shows the files that start with “aa”

23
Q

ls e

A

shows all the files and subdirectories that contain the letter “e”

24
Q

ls ?e*

A

shows all the files that contain only 1 single character of letter “e”.

25
Q

cd ~
pwd

A

brings us back to the home folder.
shows us that we are in the home folder, output: /home/ict246

26
Q

cd /tmp

A

to change from the current folder to the /tmp folder

27
Q

do section 3 and 4 of tut 2

A