layout | toc | tasks |
---|---|---|
asides |
true |
false |
By Jamie Flores
Linux is the OS you all are using on your VM. Unix (runs on Macs) is another OS that has many of the same commands. Here are some of the most useful ones! Hopefully you never open the file explorer on your VM again after reading this!
A directory is what you think of as a folder.
.
= your current directory..
= your parent directory~
= your home directory
So, if you are in ~/user/cs104/hw-username/
:
.
=~/user/cs104/hw-username/
..
=~/user/cs104/
- and as always
~
=~
Type these commands directly into your terminal.
cd <directory_name>
moves you into that directory. So,cd ..
moves you back into the parent directory of your current directory.ls
lists all the files and directories. If you specify a directory in your current directory,ls <directory_name>
will list the contents of that directory. So, if you are in thehw-username
directory, but you want to see what files you have in yourhw1
directory, simply typels hw1
.
mkdir <directory_name>
will make a new, empty directory in your current directory with the name<directory_name>
.
cp <src_file_name> <dest_directory_name>
orcp <src_directory_name> <dest_directory_name>
will COPYsrc_file_name
or the contents of<src_directory_name>
to<dest_directory_name>
(leaving the original unchanged).mv <src_file_name> <dest_directory_name>
ormv <src_directory_name> <dest_directory_name>
will MOVE the contents of the source to the destination (the original is no longer at the source). This can also be used to rename files.
subl
opens a blank sublime document.subl <file_name>
opens only that file.subl <directory_name>
opens all the files in the directory and is SUPER CONVENIENT!
NOTE: if you are using VS Code, just replace subl
with code
.
For Emacs, replace with emacs
.