cd /afs [return]The cd command specifies that you want to change directories. The /afs specifies the destination. Pressing [return] tells the terminal to execute the command.
pwd | Where am I?: This command tells you your current location in the directory tree. |
ls | List: Tells you what is in the folder at your current location (or the specified location). |
cd | Change directory: This command changes the current directory to a new directory. |
cd .. | Change directory up a level: This command changes the current directory to the directory containing the current location. |
man | Manual: Gives information about other commands. |
mkdir | Make Directory: Creates a new directory |
cat | Quickly outputs the contents of a file |
cp | Copy: Copies a file from a source to a destination |
mv | Move: Move or rename a file from a source to a destination |
ln | Link: Creates links between files. A link is (essentially) a short cut between one file and another. |
rm | Remove: Deletes a file. BE CAREFUL with this command |
rm -r | Recursive Remove: Deletes an entire directory with all contents. |
nano foobar.cIf you have a file called "foobar.c" at your current location, this will open it for editing. If not, then the file will first be created, and then opened.
gcc -o test test.cThe -o flag specifies that "test" should be the name of the output file.
/afs/nd.edu/coursefa.11/cse/cse20211.01/dropbox/[your user name]/Within this directory, the TAs will create directories called lab1, lab2, lab3, etc. Put required files in the the corresponding folder for the lab.
cd ./myVe [tab]can be a short way of typing:
cd ./myVeryLongFolderName
indent myCode.c
rm aFileIf you want to remove a folder and everything in it, do this:
rm -r aFolderIf you want to remove a whole bunch of files, this will remove all files in the current folder beginning with filePrefix:
rm filePrefix*This will remove all files in the current folder ending with .c:
rm *.cThis will attempt to erase all files and folders in the current folder, if you have permission.
rm -rf *Again, don't do this, ever.
man | manual, explains other commands |
ls | list, lists the contents of current folder |
cd | changes the current folder |
cd / | Go back to root folder |
cd .. | Go back to containing folder (up a level) |
cd ~ | Go back to home folder |
cat | output a file to console |
more | read a file at the console |
mkdir | make a folder |
cp | copy a file |
mv | move/rename a file |
rm | delete stuff (USE WITH CAUTION) |
nano | a simple file editor |
gcc | C Compiler |
ssh | remote login |
ln | makes links between files (i.e. shortcuts) |
exit | close the console/remote connection |