Command Line Interface/Commands (I) Flashcards

1
Q

which shell am I using?

A

echo $SHELL

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

send text to the CLI’s output

A

echo “hello, everyone”

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

change your current directory

A

cd _______
(name of/path to the directory you want to change
to)

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

open the manual to get info on a command

A

man ________

(name of command you want to look up)

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

send text to the CLI’s output AND have cursor appear on same line as the output

A

echo -n “Hello, everyone”

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

find out where you currently are in the file system (which directory you are in)

A

pwd

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

leave/close the manual

A

q

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

move a file from your current directory to another directory

A

mv _________ _______
(which file?) (destination)

mv jobs.txt ../..

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

create an empty file

A

touch _________

(name/extension of file)

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

create a new directory

A

mkdir ___________

(name of directory)

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

go to the home directory (three ways to do it)

A

cd

cd ~

cd $HOME

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

go to the root directory

A

cd /

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

list all the files and sub-directories in a folder

A

ls ___________

(name of folder)

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

list all the files and sub-directories in a folder AND have more info shown AND have everything in an easier-to-read format

A

ls -lah ____________

(name of directory)

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

rename a file

A

mv ________ __________

(old name) (new name)

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

move a file from your current directory to another directory and change the name of the file

A

mv __________ _________/_____

(which file?) (path to new directory/new name)

17
Q

move a file from a directory to your current directory (keep the same name for the file)

A

mv ______________ ____________

(path/name of file) ( . OR ./ )

18
Q

copy a file in your current directory

A

cp __________ __________
(which file?) (new name)

You have to give it a new name. You can’t have two files with the same name in the same directory.

19
Q

copy a directory and all its contents

A

cp -r _____________

(name of directory)

20
Q

copy a file in your current directory and move it to another directory (give it a new name)

A

cp ___________ ________/_______

(which file?) (path to destination/new name)

21
Q

Go up two levels from your current directory and copy a file. Next, move that file to the directory one level above your current directory. Don’t change the name of the file.

A

cp ../../filename ../

22
Q

delete a file from your current directory

A

rm _________

(which file?)

23
Q

delete a folder and all its contents (files and sub-directories)

A

rm -r ____________

(name of folder)

24
Q

copy just the contents of a folder (but not the directory)

A

cp _________/*

(folder name)

25
Q

print out the contents of a file

A

cat _________

(name of file)

26
Q

remove/delete a directory

A

rmdir __________
(name of directory)

the directory has to empty of files and sub-directories before you can delete it