linux, coffee and other stuff | part i

hi there stranger. i’m hiran. an intern. a guy who is trying to code his way in this world. so, urm, as i started, i am an intern. a new one of those as well. first thing my supervisors asked me to do. get used to a linux environment. i was like. okay. then they said something horrific for a newbie like me. “learn to use the command line over guis.”

okay, that’s it ladies and gentlemen. (i really wish there are some ladies reading this, if not, gents, after this, dota!)

back to my story, i had to learn to “manipulate” my workstation pc, with linux (it was ubuntu 14.04 there) and not click on those pretty buttons those ui people took ages to make. obviously as a gentle mental windows user i was hesitant.

my first assignment was to do some tasks using the command line. create a directory (as a proud windows peep would say, a, “ehem”, folder!), rename a directory, give permissions to read and write to those, check the pc stats.. so on and so forth.

first hour or two was like, why am i doing this? but also, i kinda liked the techy techy feeling. felt like one of those “hackers” from a bad movie.

First up it is not the command line here, it’s called the terminal. so don’t go searching for a command line that you won’t find.

when you first start the terminal, rather than a “dir>” we’re used to, you get a “username@pcname:~$” to type after. by default you’re in the home directory.

you can change the directory by “cd path/directory”. You can return to the home directory by “cd ~”.

to create directories, you can use “makedir directoryname”.you can create multiple directories at once by “makedir dir1 dir2 dir3”. to create a sub directories, you can use “makedir -p dirparent/dirchild”.

also here, you can specify some restrictions as well. like if you’re a windows user, you might have done this going into the properties of the folder.

“mkdir -m ug+rw mydir” is an example. here, -m defines modes. here, user and groups are allowed to read and write in mydir.

….again. why are we torturing ourselves in doing these?

simple. guis aren’t always reliable. and have actually less control over things. yes. less! read more at Command line vs. GUI by ComputerHope.

getting back. copying a directory/file. this is done by the cp command. “username@pcname:~$ cp /home/user/Downloads abc.tar.gz /home/user/Desktop”. you get the gist yeah?

so moving a file? just like before, but the command is mv. username@pcname:~$ mv /home/user/Downloads abc.tar.gz /home/user/Desktop

so, what if you want to see the contents of a fold..i mean a directory. you use the ls command. this lists all the directories and files. “username@pcname:~$ ls /home/user/Downloads”

by the way, if you forgot what commands you ran in the terminal, you can always run “history” command get the history of commands. else, you can just press the up key and get the previous commands, one by one.

also, to clear all the hubbub, use “clear” command.

if somewhere, you get stuck with permission related errors, try using “sudo” before that particular command. sudo is super user do, if you have proper permissions, the terminal will get you anywhere.

along the way, you’ll need some more tools within the environment. to get that, you can use “apt” command. this stands for advanced package tool. “username@pcname:~$ apt-get install mplayer”, if available, it’ll get you the particular software.

you can get the date by, urm “date” command. also you can set the date using “username@pcname:~$ date –set=’03 july 2015 00:57′”.

if you want to create a new user in the system, run “useradd yaylinux”. to add a password for that user, “passwd yaylinux”, and follow the instructions.

frankly. i’m getting used to these. not so hard. but really clean. and it does make you a look bit cooler. i mean, c’mon, your friend doesn’t know that you’re trying (and failing miserably) to make a little folder… a d-i-r-e-c-t-o-r-y… in linux.

here’s my days work with linux, well, a bit more than that, but felt like it can be a bit out of place. i shall go drink the rest of my coffee.

so, until next time, pour yourself a hot one. cheers.

Advertisements

3 comments

  1. manduns · July 4, 2015

    I read this and I didn’t get most of the programming bit (-.-“). Anyway, good luck with your internship!

    Like

    • Nimila Hiranya · July 4, 2015

      Haha, try those on your Linux machine and see. 😉 And thank you Amanda! 🙂

      Like

  2. Pingback: linux, coffee and other stuff | part ii | turncoffeeintocode;

spill a bit of coffee?

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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s