[SYNTAX] Working with Directories and Files

Unix C++ :: UNIX CPP :: UNIX :: SYNTAX

Go down

[SYNTAX] Working with Directories and Files

Post by Christopher on Tue Mar 16, 2010 1:26 pm

Create Directory

Code:
$ mkdir mydocs

Change Directory

Code:
$ cd mydocs

Remove Directory

Code:
$ rm -r mydocs

Creating a File

Code:
$ cat > 1.txt
<file contents>
[ctrl + D]

Appending to a File

Code:
$ cat >> 1.txt
<Text to be appended>
[ctrl + D]

Renaming or Moving a File

Code:
$ mv 1.txt 1.x

Copying a File

Code:
$ cp 1.txt 2.txt

Deleting a File

Code:
$ rm 1.txt

To go back to home Directory

Code:
$ cd ~

To go back to previous working directory

Code:
$ cd ~-

To view contents of a File

Code:
$ cat 1.txt

To view and edit a file

Code:
$ vi 1.txt
avatar
Christopher
Admin

Posts : 240
Points : 429
Join date : 2010-02-26
Age : 30

View user profile http://unixcpp.forumotion.com

Back to top Go down

Back to top

- Similar topics

Unix C++ :: UNIX CPP :: UNIX :: SYNTAX

 
Permissions in this forum:
You cannot reply to topics in this forum