Commands to use
You can run many commands and programs at the terminal, but there are only a few you really need to get started. The best thing to remember is that you can get help from each command using the --help
argument.
ls
: Use thels
command to list files in a folder. Pass it arguments for the name of the folder to list, if you do not want the listing of the current folder. You can also pass it options for how to format the list-lha
are good options to start with.cd
: Usecd
to move the shell to a new folder (directory). Pass it one argument, the path to the folder you want to move to.cp
: Thecp
command lets you copy files. Pass it arguments for the source (what to copy) and the destination (where to put it).rm
: Is used to remove aka delete a file or folder. To delete folders you need to pass in the-r
option. Beware, there is no “recycle bin” here. When you remove a file, it is gone.mkdir
: Can be used to create folders.
Example
# move into the /Users/andrew/Documents/ foldercd /Users/andrew/Documents
# Now we are in the Documents folder...# move into the /Users/andrew/Documents/Code foldercd Code
# We can make a folder for a project called HelloWorld# Notice no space between Hello and Worldmkdir HelloWorld
# Move into the new foldercd HelloWorld
# Print out the location in the terminalpwd
# Create some empty filestouch test.cpptouch test.h
# List the filesls -lha
# Move to your code foldercd ~/Documents/Code
# Explore further to do things like...
# Get a word count of all of your C++ codefind . -name *.cpp -exec cat {} \; | wc -w
# Download and interact with filescurl https://programmers.guide/book/part-0-getting-started/00-0-introduction/ > intro.html
# move into the /home/andrew/Documents/ folder (WSL users may need to create Documents folder)cd /home/andrew/Documents
# Now we are in the Documents folder...# move into the /home/andrew/Documents/Code foldercd Code
# We can make a folder for a project called HelloWorld# Notice no space between Hello and Worldmkdir HelloWorld
# Move into the new foldercd HelloWorld
# Print out the location in the terminalpwd
# Create some empty filestouch test.cpptouch test.h
# List the filesls -lha
# Move to your code foldercd ~/Documents/Code
# Explore further to do things like...
# Get a word count of all of your C++ codefind . -name *.cpp -exec cat {} \; | wc -w
# Download and interact with filescurl https://programmers.guide/book/part-0-getting-started/00-0-introduction/ > intro.html
# move into the /c/Users/andrew/Documents/ foldercd /c/Users/andrew/Documents
# Now we are in the Documents folder...# move into the /c/Users/andrew/Documents/Code foldercd Code
# We can make a folder for a project called HelloWorld# Notice no space between Hello and Worldmkdir HelloWorld
# Move into the new foldercd HelloWorld
# Print out the location in the terminalpwd
# Create some empty filestouch test.cpptouch test.h
# List the filesls -lha
# Move to your code foldercd /c/Users/andrew/Documents/Code
# Explore further to do things like...
# Get a word count of all of your C++ codefind . -name *.cpp -exec cat {} \; | wc -w
# Download and interact with filescurl https://programmers.guide/book/part-0-getting-started/00-0-introduction/ > intro.html