Basic Linux Commands
You can use the man command to quickly check the manual of a command/program. For example, to check the manual of the cp command, you can simply do: $ man cp
Examples of Basic Commands in the Linux Command Line
- To check your current directory use the command:
$ pwd - Copy a folder to your home directory:
$ cp -r /opt/intro ~
Copy a file to your home directory:
$ cp /opt/intro/helloworld.f ~
Note: 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
Note: 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