basic commands Flashcards

1
Q

how do you move through the directories

A

by using cd

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

how do you list everything in the current directory?

A

ls

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

How do you find out where you are in the directory hierarchy?

A

pwd

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

how do you delete(remove) a file?

A

rm

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

how do you remove a directory?

A

rm -r <directory></directory>

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

How do you include spaces in the name of a directory?

A

you enclose in ” “

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

how do you move out of a directory?

A

cd ..

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

how do you make a new folder?

A

mkdir <“name of folder”>

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

how do you clear the terminal?

A

clear

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

How do you duplicate a document?

A

you use cp

julio$ cp bayram.png bayramCopy.png

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

how do you put a copy of a doc in a directory?

A

you also use cp but the destination must be the new path to the target folder

juliohud:desktop julio$ cp bayram.png ~/documents

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

How do you move a file or folder to another directory?

A

using mv

julio$ mv “test folder” ~/documents

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

how do you make a new text document?

A

you use nano

julio$ nano“test file”

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

how do you open a text document?

A

you also use nano

julio$ nano “dave was here”

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

how do you open/read any file?

A

that is the first line of the text

use cat

juliohud:desktop julio$ cat“dave was here”
hey this is so cool!

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

How do you switch users?

A

by using su and then typing your password

juliohud:desktop julio$ su resolume

Password:

17
Q

How do you find out which user you are?

A

just type whoami

juliohud:desktop julio$ whoami
julio

18
Q

How do you log off from a user account?

A

exit

19
Q

How do you run a command as ROOT or as another user?

A

use sudo and then the name of the desired user, sudo with no name assumes the root

20
Q

How do you show all commands typed during a session

A

use history

21
Q

how do you gain access to any user in your computer?

A

you must login as root by using sudo :

julio$ sudo su root

now you can read/write anything!

22
Q

how can you get direct access to the terminal of a mac without having to enter your password?

A

press the startup button then hold command+”s

23
Q

How can I reset the password of my mac if I lost my password, through the terminal?

A

mount -uw /

launchctl load

/System/Library/LaunchDaemons/com.apple.DirectoryServices.plist

ls /Users

dscl . -passwd /Users/username newPassword

reboot

24
Q

How can I change my password from the terminal?

A

use the command passwd

25
Q

how do you cancel a command?

A

control + “c

26
Q

how do you change the password for another user?

A

using sudo

julio$ sudo passwd resolume

27
Q

How do we shutdown a mac from the terminal at an appointed time?

A

sudo shutdown -h now

where now can be also expressed in military time

-h indicates ‘halt’, you could also reboot the computer by adding -r instead

28
Q

how do we shutdown or restart a mac immediately from the terminal?

A

you type sudo halt or sudo reboot

29
Q

how do we list all files in a directory together with detailed info on their permissions?

A

we type ls -l

30
Q

how do you change the owner of a file or directory?

A

sudo chown NewOwner Directory

31
Q

how do you cancel a shutdown process?

A

$ sudo killall shutdown

32
Q

how do you change permissions?

A

sudo chmod 777 nameOfDocument

(the 7 indicates wrx, if it was 5 it means only rx, if it twere 0 nobody can wrx)