Creating and removing files and folders.


Ah yes… You might be wondering how the heck we can do a ‘cd’ to get into a directory before it has been created huh? No worries over there friend. What’s the problem now? We have to make a directory right? Alright. Suppose the name of the directory we want to make is ‘squishgump’. Then all we have to do is

mkdir squishgump

Now if we just do an ‘ls’ over where you  executed the above command from, viola! There lies squishgump!!! You can do ‘cd squishgump’ and you’ll get into the wonderful directory(folder) that you just created.

Now let’s see how you can create files over here. As a beginning, let’s create a text file. All ubuntu installations come with the ‘gedit’ text editor installed by default. So in order to create a text file named ‘crungbung’, what we do is

gedit crunngbung.txt &

Cool! Once you hit enter, the gedit text editor will pop up. Type in the thing you love the most, then hit ‘ctrl-s’ to save it. Hit ‘ctrl-q’ to quit the editor. We’re back at the terminal right? Do an ‘ls’ and there lies crungbung too!

(Note : See the ‘&’ sign at the end of the command? It is to run the command in the background so that we can use the terminal for other purposes. Try running the command without the ‘&’ and you will see that the prompt doesn’t reappear. If it so happens that you forgot to put the ‘&’ sign and you want to use the terminal for something else without closing the open gedit application, just hit ‘ctrl-z’ while you’re on the terminal. This will bring back the prompt without closing gedit. You must also type in bg and hit enter to make gedit run in the background.)

What’s the fun if the creator can’t destroy what he made? Ha! Frankenstein comes to mind. Anyway, to remove/delete our dear old crungbung, do

rm crungbung.txt

Now if you do an ‘ls’, crungbung is not there anymore. 😦 sob… Alright. We can’t hang around crungbung all day now, can we? Let’s destroy squishgump himself! HA HA!

Get back to the folder where you created squishgump. (If you’re currently within the squishgump directory, just type ‘cd ..’)

Now to remove/delete a folder, in our case squishgump, you have to do

rm -r squishgump

And after that if you do an ‘ls’, squishgump is no more.

Check it out. 🙂

PS : ALWAYS PRACTICE USING TAB COMPLETION!

 

Advertisements

One thought on “Creating and removing files and folders.

Hey! What do you think? Share your thoughts. :)

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s