Go/navigate filesystem
1. Print all working directory
$
pwd
2. Lists all files & folder in the current working directory
$ ls
2014 2015 hardware.txt
By default ls list all files & folder in the current working directory alphabetically.
3. Switches into any directory that you specify, in this case directory "2015".
$ cd 2015
4. Move up one directory from current working dir
$ cd ..
5. Create one directory, in the current working dir, in this case directory "media"
$ mkdir media
6. Create "empty" file in current working directory
$ touch keyboard.txt
Copy, moves and delete files
1. Listing files that hidden
$ ls -a
2. Listing files & folder in tables / long format.
$ ls -l
3. Listing files $ folders in time manner
$ ls -t
4. Copying a file or files
$ cp * superman/
$ cp superman
5. Delete a file
$ rm waterboy.txt
delete a folder (recursive)
$ rm -r slapstick
Redirection
Redirect an input
Redirect an output
$ echo "Hello"
Redirect an output to text file (>)
$ echo "Hello" > hello.txt
and then:
$ cat hello.txt
example(2):
$ cat oceans.txt > continents.txt
Warning: > will overwrite all original content inside continents.txt
example(3) append:
$ cat glaciers.txt >> rivers.txt
>> will take the standard output of the command on the left and appends (adds) it to the file on the right.
Here, the the output data of rivers.txt will contain the original contents of rivers.txt with the content of glaciers.txt appended to it.
example(4)
$