Tuesday, February 15, 2011

Learning Linux and programming C

After installing the virtualbox ubuntu machine on my Window 7 machine, I had some problems getting used to doing some basic commands (since I have been a Windows user my entire life). I have compiled a list of common commands I use.

Ps. I highly recommended adding the guest addons to increase the screen resolution for the Linux virtualbox. It looks lovely.  To do this follow these steps...


How to Install Guest Additions on Ubuntu 10.10?

Additional packages and updates released by ubuntu people to test with VB. You can download them and install by following method to get high screen resolutions. This worked in one host and not in other for me. So, I’m not 100% sure this will work for all. Please share your results on comments area.
Make sure virtual machine is having internet with download access. Open terminal ( Application –> Accessories –> Terminal)
Type
sudo apt-get update
and provide the root password, above command will check and download the updates available on internet server.
Type,
sudo apt-get install build-essential linux-headers-$(uname -r)
Now, type,
sudo apt-get install virtualbox-ose-guest-x11
Restart and check the screen size, seamless and full screen mode on ubuntu 10.10, all should work.
Let me know how it worked for you.

Your screen will come out to a pretty resolution like follows.
----

My current list of common linux commands

cd: changes directory. Example) cd desktop

ls: shows contents of current folder

gvim: opens up graphical vim editor

chmod 777 <name of program to change permissions>: to change permissions when it states "./<nameofprogram> permission denied"

gcc -ansi assembler.c -o <programoutput>: to compile a file with gcc ansi-c compiler produces an executable file a.out (default) or <programoutput>

a.out <inputfile> <outputfilename>: If your program does not have any errors, you will notice that the above command produces an executable file
named a.out. This is the standard name for the executable created by gcc unless you provide your own preferred name.

./a.out <inputfile> <outputfilename>: If the above doesn't run your program try running it by typing this.

gcc -ansi -o assemble assembler.c: If you would like to call your executable with a different name, you need to use the -o option of gcc.
For example, if you want your executable named assemble, you need to compile the source code for your assembler (assembler.c) with the following command.

gcc -lm -ansi -o assemble assembler.c: If you decide to use any of the math functions in math.h, you also have to link the math library by using the command.

./assemble <inputfile> <outputfilename>: To run your assembler now, just use the following command.

man gcc: If you would like to learn more about gcc, try the following on the UNIX command prompt.

No comments:

Post a Comment