basic commands Flashcards
how do you move through the directories
by using cd
how do you list everything in the current directory?
ls
How do you find out where you are in the directory hierarchy?
pwd
how do you delete(remove) a file?
rm
how do you remove a directory?
rm -r <directory></directory>
How do you include spaces in the name of a directory?
you enclose in ” “
how do you move out of a directory?
cd ..
how do you make a new folder?
mkdir <“name of folder”>
how do you clear the terminal?
clear
How do you duplicate a document?
you use cp
julio$ cp bayram.png bayramCopy.png
how do you put a copy of a doc in a directory?
you also use cp but the destination must be the new path to the target folder
juliohud:desktop julio$ cp bayram.png ~/documents
How do you move a file or folder to another directory?
using mv
julio$ mv “test folder” ~/documents
how do you make a new text document?
you use nano
julio$ nano“test file”
how do you open a text document?
you also use nano
julio$ nano “dave was here”
how do you open/read any file?
that is the first line of the text
use cat
juliohud:desktop julio$ cat“dave was here”
hey this is so cool!
How do you switch users?
by using su and then typing your password
juliohud:desktop julio$ su resolume
Password:
How do you find out which user you are?
just type whoami
juliohud:desktop julio$ whoami
julio
How do you log off from a user account?
exit
How do you run a command as ROOT or as another user?
use sudo and then the name of the desired user, sudo with no name assumes the root
How do you show all commands typed during a session
use history
how do you gain access to any user in your computer?
you must login as root by using sudo :
julio$ sudo su root
now you can read/write anything!
how can you get direct access to the terminal of a mac without having to enter your password?
press the startup button then hold command+”s”
How can I reset the password of my mac if I lost my password, through the terminal?
mount -uw /
launchctl load
/System/Library/LaunchDaemons/com.apple.DirectoryServices.plist
ls /Users
dscl . -passwd /Users/username newPassword
reboot
How can I change my password from the terminal?
use the command passwd
how do you cancel a command?
control + “c”
how do you change the password for another user?
using sudo
julio$ sudo passwd resolume
How do we shutdown a mac from the terminal at an appointed time?
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
how do we shutdown or restart a mac immediately from the terminal?
you type sudo halt or sudo reboot
how do we list all files in a directory together with detailed info on their permissions?
we type ls -l
how do you change the owner of a file or directory?
sudo chown NewOwner Directory
how do you cancel a shutdown process?
$ sudo killall shutdown
how do you change permissions?
sudo chmod 777 nameOfDocument
(the 7 indicates wrx, if it was 5 it means only rx, if it twere 0 nobody can wrx)