• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 05:03
CEST 11:03
KST 18:03
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL20] Ro24 Preview Pt1: Runway132v2 & SC: Evo Complete: Weekend Double Feature4Team Liquid Map Contest #21 - Presented by Monster Energy9uThermal's 2v2 Tour: $15,000 Main Event18Serral wins EWC 202549
Community News
Maestros of The Game—$20k event w/ live finals in Paris20Weekly Cups (Aug 11-17): MaxPax triples again!13Weekly Cups (Aug 4-10): MaxPax wins a triple6SC2's Safe House 2 - October 18 & 195Weekly Cups (Jul 28-Aug 3): herO doubles up6
StarCraft 2
General
What mix of new and old maps do you want in the next 1v1 ladder pool? (SC2) : 2v2 & SC: Evo Complete: Weekend Double Feature Geoff 'iNcontroL' Robinson has passed away The GOAT ranking of GOAT rankings RSL Revival patreon money discussion thread
Tourneys
RSL: Revival, a new crowdfunded tournament series Maestros of The Game—$20k event w/ live finals in Paris Sparkling Tuna Cup - Weekly Open Tournament Monday Nights Weeklies Master Swan Open (Global Bronze-Master 2)
Strategy
Custom Maps
External Content
Mutation # 487 Think Fast Mutation # 486 Watch the Skies Mutation # 485 Death from Below Mutation # 484 Magnetic Pull
Brood War
General
Flash On His 2010 "God" Form, Mind Games, vs JD Joined effort New season has just come in ladder BW General Discussion Flash Announces (and Retracts) Hiatus From ASL
Tourneys
[ASL20] Ro24 Group B [ASL20] Ro24 Group C BWCL Season 63 Announcement [CSLPRO] It's CSLAN Season! - Last Chance
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates [G] Mineral Boosting Muta micro map competition
Other Games
General Games
Nintendo Switch Thread General RTS Discussion Thread Dawn of War IV Path of Exile Stormgate/Frost Giant Megathread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread The year 2050 Things Aren’t Peaceful in Palestine European Politico-economics QA Mega-thread
Fan Clubs
INnoVation Fan Club SKT1 Classic Fan Club!
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece [\m/] Heavy Metal Thread
Sports
2024 - 2026 Football Thread TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion
World Cup 2022
Tech Support
High temperatures on bridge(s) Gtx660 graphics card replacement Installation of Windows 10 suck at "just a moment"
TL Community
The Automated Ban List TeamLiquid Team Shirt On Sale
Blogs
Evil Gacha Games and the…
ffswowsucks
Breaking the Meta: Non-Stand…
TrAiDoS
INDEPENDIENTE LA CTM
XenOsky
[Girl blog} My fema…
artosisisthebest
Sharpening the Filtration…
frozenclaw
ASL S20 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2266 users

So I got Linux n stuff... now help? :( - Page 2

Blogs > evanthebouncy!
Post a Reply
Prev 1 2 3 Next All
Jank
Profile Blog Joined March 2008
United States308 Posts
January 07 2009 09:34 GMT
#21
Not that linux isn't a fantastic os and emacs a fantastic powerful editor, but I think you should stick to windows while learning C (at least at first). I think you're trying to tackle too many things at once. I would pick one thing to focus on at a time, attempting to learn programming on an unfamiliar os will just slow you down. Not to mention how complicated emacs can be if you want it to be perfect for your use lol. I'd suggest using visual studio express or something first in windows. It'll let you focus more on the programming and will be a lot less overwhelming.

But, if you don't wanna heed my advice then uh Good luck!
"You don't know you're wearing a leash if you sit by the peg all day." - Michael Parenti
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
January 07 2009 09:42 GMT
#22
On January 07 2009 18:34 Therapy wrote:
Not that linux isn't a fantastic os and emacs a fantastic powerful editor, but I think you should stick to windows while learning C (at least at first). I think you're trying to tackle too many things at once. I would pick one thing to focus on at a time, attempting to learn programming on an unfamiliar os will just slow you down. Not to mention how complicated emacs can be if you want it to be perfect for your use lol. I'd suggest using visual studio express or something first in windows. It'll let you focus more on the programming and will be a lot less overwhelming.

But, if you don't wanna heed my advice then uh Good luck!


Everyone in my class, or will be in 20 days will be using linux coding in C. I don't think it's that hard or overwhelming. As I said, I'm not completely hopeless. Anyways I just wrote my first program and it printed hello world, awesome!
Wish I know how to let it print it 10 times or more, wish I could write a program that could take an input x, that would print hello-world x times.
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
r3dox
Profile Blog Joined May 2003
Germany261 Posts
January 07 2009 09:44 GMT
#23
u have to use ./a.out in order to run a executable
Jank
Profile Blog Joined March 2008
United States308 Posts
Last Edited: 2009-01-07 09:50:45
January 07 2009 09:46 GMT
#24
Ah, if your class is using it then definitely stick with linux. Sounds like you're coping with the semi-foreign os fairly well (tho ubuntu is pretty nice and preconfigured for beginning users) Good luck with C, I'm a programming n00bie myself, just know a bit of c++ and php but not enough to really create anything of value. Although I've made my own lil forum system in php/mysql its fairly simplistic and boring

EDIT:
also,

On January 07 2009 18:42 evanthebouncy! wrote:
Wish I know how to let it print it 10 times or more, wish I could write a program that could take an input x, that would print hello-world x times.


int num;
printf ("Enter number of super awesome greetings you want: ");
scanf ("%d",&num);

for(int i = 0; i < num; i++)
printf ("Hello World! ");

should work fine, I'm not overly familiar with printf/scanf tho as i primarily use cout and cin for console programs (c++ stuff)
"You don't know you're wearing a leash if you sit by the peg all day." - Michael Parenti
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
January 07 2009 09:52 GMT
#25
On January 07 2009 18:44 r3dox wrote:
u have to use ./a.out in order to run a executable

Hmm what does ./ do?
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
Jank
Profile Blog Joined March 2008
United States308 Posts
January 07 2009 09:53 GMT
#26
On January 07 2009 18:52 evanthebouncy! wrote:
Show nested quote +
On January 07 2009 18:44 r3dox wrote:
u have to use ./a.out in order to run a executable

Hmm what does ./ do?

well in windows to run a program in console u just type the program name, but in bash on linux the ./ says you are trying to run something in the current directory
"You don't know you're wearing a leash if you sit by the peg all day." - Michael Parenti
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
January 07 2009 09:53 GMT
#27
Aside from that it's been a long night, partitioning my laptop till now, I'm very happy. I'm going to bed. Thanks alot everyone. Gnite!
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
January 07 2009 09:54 GMT
#28
On January 07 2009 18:53 Therapy wrote:
Show nested quote +
On January 07 2009 18:52 evanthebouncy! wrote:
On January 07 2009 18:44 r3dox wrote:
u have to use ./a.out in order to run a executable

Hmm what does ./ do?

well in windows to run a program in console u just type the program name, but in bash on linux the ./ says you are trying to run something in the current directory

Then how come emacs work in every directory?
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
Jank
Profile Blog Joined March 2008
United States308 Posts
January 07 2009 09:57 GMT
#29
Because its registered as an appliation in linux. Whereas programs you create or things not yet installed will need to be run using ./ if you wish to run them from current direction
"You don't know you're wearing a leash if you sit by the peg all day." - Michael Parenti
HeadBangaa
Profile Blog Joined July 2004
United States6512 Posts
January 07 2009 10:06 GMT
#30
Evan, are you Comp Sci? I thought you were something in social sciences, because your family is full of engineers and you wanted to c-c-c-combo break?

I assume you are not Comp Sci. I'm always excited to see people take up hobby programming! It is sooo enabling.

Let's see... I bought that same C book, read a few pages, and never opened it again. Yucky.

Ahh shit nevermind. I went over and grabbed this book from my boxes and am looking through it. It's not bad at all. I think I was thinking of a C++ book I bought that was written by the C++ author (yep I checked, I was thinking of Bjarne Stroustrup's The C++ Programming Language).

HERE WE GO

---------------------------------------------
DISCLAIMER: I AM NOT A LINUX EXPERT, BUT I USED IT THROUGHOUT COLLEGE. I HAVE A BS IN COMP SCI
---------------------------------------------

Let's start with your sexy Ubuntu environment. First thing, as a previous poster mentioned, make sure you have the incredible gcc ("GNU Compiler Collection") program installed. Basically, this all-in-one awesomeness will turn a simple text file into an executable program (it "compiles" your hand-written program). An executable on Unix/Linux is suffixed as ".out" whereas on Windows it is ".exe". You should expect gcc to spit out "a.out" (by default; this can be overriden) for any program you compile on Unix/Linux.

gcc works for many languages (thus, "all-in-one"). From their page:
The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Java, and Ada, as well as libraries for these languages.


In other words, you can focus on the programming (fun stuff) instead of nasty library and dependency mangling.

(I won't go into details about the syntax of these commands, but you should read up on sudo and apt-get because this is essential Ubuntu/Linux stuff).

1) Update your Ubuntu installation files and install core utilities, including gcc
- open a terminal and enter these commands, one by one:
      sudo apt-get update
      sudo apt-get install build-essential

2) Choose a Linux text editor.
My favorite is vim ("Vi Improved"), which is a "modal text editor". It is an extended version of vi, an old school Unix editor.
My alma mater, UCSD, has a good introduction to vi and a brief addendum for vim.

This is the first challenge of programming. Learning how to use a REAL text editor! (the other "classic" alternative is emacs which some of my friends use, but I genuinely hate it. emacs is an editor. emacs is an operating system. emacs is a way of life. emacs is overkill).

Spend maybe 1 hour learning vim and you're set for life. It enables you to dominate text files without reaching for the mouse (gvim is a "cheater version" of vim that let's you click with mouse. Defeats the purpose, IMO).

Customizing vim is not necessary but very helpful. You can put default settings in your home directory. Just create a file named .vimrc in your home directory (cd ~) and put settings there. Here is my simple, conventional .vimrc file:

+ Show Spoiler +

" HeadBangaa's .vimrc
"
" 10/2008 -- for Cygwin VIM


" fix backspace, and make everything pretty
set backspace=2
set syntax=color
syntax on
colorscheme pablo

" set search behavior, ruler, and line numbers
set showmatch
set ignorecase
set ruler
set nu

" use real tabs of length=4
set softtabstop=4
set shiftwidth=4
set smartindent

" set screen size
set lines=52
set columns=80
set textwidth=80


3) Open your The [ANSI] C Programming Language (2nd Ed.) book and read pages 5-6
Ok this is a bit lazy of me, but there's no better start, really. To make sure your compiler and operating system are getting along, this walks you through the trivial "Hello, World!" program. One slight alteration: use gcc instead of cc ("cc" is a Unix dinosaur; Linux redirects "cc" to "gcc" anyways.)

If you're using vim as recommended:
      cd ~
      mkdir HelloWorld ; cd HelloWorld
      vim hello.c
This will create "hello.c" in a subdirectory of your home directory.

I suggest reading the rest of Chapter 1 as well!

4) ......

You've entered the world of C/Linux programming!! YOU FUCKING GEEK~!


Got any cool program ideas?
People who fail to distinguish Socratic Method from malicious trolling are sadly stupid and not worth a response.
HeadBangaa
Profile Blog Joined July 2004
United States6512 Posts
Last Edited: 2009-01-07 15:05:38
January 07 2009 10:07 GMT
#31
Ooops, your blog grew while I was typing all this. DON'T USE EMACS EVAN, NOOOOO!!!


looool my entire post is OBSOLETE. You don't have zero experience!!! LIAR!!!
People who fail to distinguish Socratic Method from malicious trolling are sadly stupid and not worth a response.
chiflutz
Profile Joined June 2006
Romania1025 Posts
Last Edited: 2009-01-07 13:34:57
January 07 2009 11:05 GMT
#32
For the initial problem, after compiling you want to do a chmod +x a.out, which sets its executable bit. Then you can run it with ./a.out.

Also, regarding the path issue, the /bin directory contains the most common binaries (or executables, as it were) of software currently on the system. /bin is in the path environment variable of every user, thus you can run emacs from any directory by simply typing emacs because your shell looks for a binary called "emacs" in every directory within your current path variable.

Right, I'm sleepy, I read some more posts. Therapy's code for even more Hello Worlds is right.

To search for files/directories from the command line there's the ancient locate tool. You need to run sudo updatedb or sudo locate -u to force a database update, wait a bit until it finishes indexing everything new, then use locate <search query>.

New programs are mostly installed in the same place, /usr subdirectories (most software) or /home subdirectories (e.g. your /home/<username> one, the default if you're prompted for an install path or if you're compiling the program from source). The /bin (and, respectively, /sbin) directories actually contain symlinks - think Windows-style shortcuts - to the actual files, with the exact same name.

Hope this makes sense to you. Have fun
kt violet Korea (South). July 27 2012 15:54. Posts 23
0xDEADBEEF
Profile Joined September 2007
Germany1235 Posts
Last Edited: 2009-01-07 13:14:39
January 07 2009 13:10 GMT
#33
You can't write "a.out" and expect Linux to find the file in the current directory because the current directory is never set in $PATH by default. In Windows, it is. But that is considered a small security risk because you might accidentally execute a file in the current directory which you didn't want to execute. So by default only the stuff in the "bin" directories (/bin /usr/bin /usr/local/bin) is set in $PATH and so the system finds it when you just type the name without a full or relative path in front.
If you want to have the same behavior as in Windows, do a export PATH=$PATH:. (notice the dot at the end - it stands for current directory, which will thus be appended to the already existing PATH variable). This will just last for the current shell session though - to make it permanent add it to your ~/.bash_profile (or ~/.bashrc if it is executed) - I'm not going into detail on these files, just know that they are automatically executed when you log in (at a shell), so it's some sort of Autorun for the shell.

Executables in Linux typically don't have any file extension (think of /bin/ls, /bin/bash etc.) but you could name them however you want to - even ".exe" although that would be confusing because it would not be executable on Windows (because both systems have a different format for executables).
gcc names an executable a.out by default but you can change that by just writing e.g. gcc -o exename src.c
Recommendation: use no extension or ".bin"
phase
Profile Blog Joined January 2008
United States399 Posts
Last Edited: 2009-01-07 13:21:22
January 07 2009 13:13 GMT
#34
This is the first challenge of programming. Learning how to use a REAL text editor! (the other "classic" alternative is emacs which some of my friends use, but I genuinely hate it. emacs is an editor. emacs is an operating system. emacs is a way of life. emacs is overkill).


The real reason vi is better than emacs: it was written by someone at UC Berkeley.... and you go to UC Berkeley. hehe.

But in all seriousness, I like to use it because it doesn't involve using the mouse at all. You just gotta figure out all the little keys and commands that let you do stuff like search/replace, cut/paste, etc.

I picked up vi by just knowing the most basic commands (i to insert, hjkl to navigate when not in insert mode, :w to save, :q to quit, :wq to save and quit, :q! to quit without saving, u to undo, and spamming esc to get out of whatever mode you were in previously), and then if I had to do something more complicated, looking up a hack on google until I memorized how to do it. Basically the list I spelled out in the ( ) is like 90% of what you use in vi.

Edit: Also useful for when you code, is creating an .exrc file (with vi as well lol), and in that file type these things:

:set number
:set autoindent
haduken
Profile Blog Joined April 2003
Australia8267 Posts
January 07 2009 13:15 GMT
#35
If you want your executable to run from anywhere, you need to place it in /bin or /usr/bin

this is obviously not advisable for your own compiled code so yeah unless you declared your own path environ, you need to invoke the binary with a ./ in the front in the current directory.

like others have said, you should use gcc and gdb to compile and debug your programs.

do man gcc or info gcc...

expect to read through a lot of man pages blah blah to geta hang of the common tools.

I would suggest you head down to O'Reily 's site and have a look browse through their linux PDFs (Most of their books are open sourced so you can download and read it as a pdf)

But honestly, this is all very much info overload for some one starting out.
Rillanon.au
haduken
Profile Blog Joined April 2003
Australia8267 Posts
January 07 2009 13:18 GMT
#36
Oh yeah, stick with Linux
It is so much easier (and free) to obtain tools to learn programming.

VI or VIM is so much superior to emac in just about any way possible but apple is apple, orange is orange.
Rillanon.au
0xDEADBEEF
Profile Joined September 2007
Germany1235 Posts
January 07 2009 13:29 GMT
#37
On January 07 2009 22:18 haduken wrote:
VI or VIM is so much superior to emac in just about any way possible but apple is apple, orange is orange.


Uhm, no? :p
Both editors are amazingly powerful, and both are also amazingly weird for someone who is used to Windows or Mac GUI editors.
Decide for yourself whether it's worth learning one of them - if you already know a bit about Emacs, just stick with it. There's nothing wrong with one or the other except from a personal preference perspective.
If you want a more Windows/Mac like editor, I can recommend JEdit 4.3+, or Eclipse as an IDE.
HeadBangaa
Profile Blog Joined July 2004
United States6512 Posts
January 07 2009 15:04 GMT
#38
Also, emacs key bindings are available for every editor that exists. Eclipse, etc. Still, use Vi!
People who fail to distinguish Socratic Method from malicious trolling are sadly stupid and not worth a response.
b3h47pte
Profile Blog Joined May 2007
United States1317 Posts
January 07 2009 16:03 GMT
#39
On January 07 2009 16:29 evanthebouncy! wrote:
Thx Tec, my eecs roomate recommended getting a linux for that because he says linux has the more natural compiler and windows has a shit compiler or something haha.
Hi Selbon, I use linux just to learn C, I still have windows.


The Visual Studios compiler is absolutely fine :|
azndsh
Profile Blog Joined August 2006
United States4447 Posts
January 07 2009 17:17 GMT
#40
lolol... I've never seen so much bad/wrong/completely offtopic responses in one thread

your original question has already been answered, but to summarize very quickly:
in linux, the command you type has to be built-in command ("cd", "ls", etc.) or a program in one of your executable folders which is specified by the PATH stuff (most likely "emacs", and tons of other common stuff "top", "less", etc. can be run just by typing their name)

"./" simply specifies the current folder you're in. you need need to specify a location to run programs not in the default executable folders (or you can add it to your PATH like people have mentioned though I don't recommend it).

basically, you don't need extra permissions to edit stuff in your personal folders, so you can't accidentally run a program and screw yourself over, and the "./" also means that you know you're running a program that's not in the executable folders
Prev 1 2 3 Next All
Please log in or register to reply.
Live Events Refresh
Next event in 58m
[ Submit Event ]
Live Streams
Refresh
StarCraft: Brood War
Sea 7406
PianO 657
Killer 621
Larva 620
Pusan 339
ggaemo 337
Hyun 309
Soma 160
Rush 49
NotJumperer 28
[ Show more ]
Free 23
HiyA 16
Noble 15
Sacsri 13
Dota 2
XcaliburYe406
febbydoto11
League of Legends
JimRising 437
Dendi0
Counter-Strike
Stewie2K1762
Super Smash Bros
Mew2King28
Heroes of the Storm
Khaldor176
Other Games
summit1g7980
singsing1709
Nina129
SortOf121
Happy46
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• Berry_CruncH496
• Reevou 5
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos1016
Upcoming Events
Sparkling Tuna Cup
58m
SC Evo League
2h 58m
Chat StarLeague
6h 58m
Razz vs Julia
StRyKeR vs ZZZero
Semih vs TBD
Replay Cast
14h 58m
Afreeca Starleague
1d
Queen vs HyuN
EffOrt vs Calm
Wardi Open
1d 1h
RotterdaM Event
1d 5h
Replay Cast
1d 14h
Afreeca Starleague
2 days
Rush vs TBD
Jaedong vs Mong
Afreeca Starleague
3 days
herO vs TBD
Royal vs Barracks
[ Show More ]
Replay Cast
3 days
The PondCast
4 days
Replay Cast
4 days
LiuLi Cup
5 days
Cosmonarchy
5 days
OyAji vs Sziky
Sziky vs WolFix
WolFix vs OyAji
BSL Team Wars
5 days
Team Hawk vs Team Dewalt
BSL Team Wars
5 days
Team Hawk vs Team Bonyth
SC Evo League
6 days
[BSL 2025] Weekly
6 days
Liquipedia Results

Completed

Jiahua Invitational
uThermal 2v2 Main Event
HCC Europe

Ongoing

Copa Latinoamericana 4
BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Qualifiers
ASL Season 20
CSL Season 18: Qualifier 1
Acropolis #4 - TS1
CSLAN 3
SEL Season 2 Championship
WardiTV Summer 2025
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
BLAST.tv Austin Major 2025

Upcoming

CSL Season 18: Qualifier 2
CSL 2025 AUTUMN (S18)
LASL Season 20
BSL Season 21
BSL 21 Team A
Chzzk MurlocKing SC1 vs SC2 Cup #2
RSL Revival: Season 2
Maestros of the Game
EC S1
Sisters' Call Cup
IEM Chengdu 2025
PGL Masters Bucharest 2025
MESA Nomadic Masters Fall
Thunderpick World Champ.
CS Asia Championships 2025
Roobet Cup 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.