Actions

Difference between revisions of "Basic Linux Commands"

From Montana Tech High Performance Computing

(Created page with "==Exercises of Basic Linux Commands== *To check your current directory use the command: <code>$ pwd</code> *Copy an folder to your home directory: <code>$ cp -r /opt/intro...")
(No difference)

Revision as of 09:22, 22 September 2017

Exercises of Basic Linux Commands

  • To check your current directory use the command:

$ pwd

  • Copy an folder to your home directory:

$ cp -r /opt/intro ~

Copy a file to your home directory:

$ cp /opt/intro/helloworld.f ~

The tilde symbol is your home directory

  • List the contents of your home directory:

$ ls

  • Go to the newly copied directory intro and list contents:

$ cd intro

$ ls

  • Create a new folder, testfolder, here

$ mkdir testfolder

$ ls

  • Move/Rename a file(or folder)

$ mv helloworld.f helloworld2.f

$ls

$ mv helloworld2.f ./testfolder/

$ ls

$ ls ./testfolder

Here the dot above represents the current directory.

  • Go back to your home directory

$ cd

  • Delete file/folder

$ ls

$ rm helloworld.f

$ ls

$ rm -r intro

$ ls