«

»

Jun 16

Putty Command (Basic)

Helpful Unix Terminal Commands
Conventions Used
Boldface is what you type at the command line.
command is the name of the command.
(If you know a command and doesn’t know how to use it, type man name_of_command. The man
page will tell you all you need to know about using the command)
Make/List/Remove/Rename Directory
• Make directory (mkdir directory_name)
• Change Directory/Folder (cd directory_name)
• List contains of directory (ls)
• Remove directory (rmdir directory_name)
• Rename directory (mv directory_name_old directory_name_new)
Example:
Make a directory called mydoc mkdir mydoc
Enter directory mydoc cd mydoc
To list contents of directory ls
(if you are in mydoc)
To list contents of directory ls mydoc
To return to home cd ..
To remove mydoc rmdir mydoc
To rename a directory mv mydoc mydoc-new
Print Working Directory
• Display current working directory ( pwd )
Example:
Show current working directory pwd
Create/Copy/List/Rename/Remove File
• Create a file (emacs filename) — more on this in another document!
(many ways of doing this, pick your favorite editor!, we will use emacs here)
• Copy a file (cp filename_source filename_destination)
• List a file (ls filename)
• Rename a file (mv filename_old filename_new)
• Remove a file (rm filename)

Example:
Create a file emacs test.cpp (save: ctrl-x-s, exit: ctrl-x-c)
Copy a file cp test.cpp new.cpp
List a file ls test.cpp
Rename a file mv new.cpp new2.cpp
Remove/Delete a file rm test.cpp
Compile/Execute
• Compile a file (CC -o filename filename.cpp)
• Execute (filename)
Example:
Compile a file CC -o hello_world hello_world.cpp
Execute hello_world (observe the output)
Shortcuts
Well, the followings are not shortcuts to get your programming assignments completed. However,
some of these can help to make ‘life’ much easier!
• List the commands that you have used (history)
• Re-execute the last command (!!)
Example:
List the command history history
Pick a command to re-execute !# (# obtain from history list)
Re-execute the last command !!
Repeat Compilation !CC

Random Posts

Loading…

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Captcha Garb (1.5)