[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

question regarding linux command line

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 6
Thread images: 1

File: zCd3pqC.jpg (164KB, 724x500px) Image search: [Google]
zCd3pqC.jpg
164KB, 724x500px
hey guys, can someone tell me what does ./ do in linux command line

google gives me nothing and i couldnt find it anywhere else

pic unrelated
>>
./ does nothing.

./something tries to execute something in the current working directory. If this something doesn't exist or is not set executable, then nothing happens.
>>
>>117703
hm thanks, but what happens if i put it like this
./something a b c
how do i include a b c in my code, is it stdin?
i dont use linux and this is asked from my prof
sorry for my ignorence
>>
>>117704
Yeah. In that case, a, b and c are parameters.
>>
>>117702
It references the current directory, e.g.
>ls ./
will list the contents of the current directory. This is the same as
>ls .
or just
>ls

Every directory always has two special links in it, '.' and '..'. The single dot references itself, while the two dots reference its parent directory (the only exception being the root directory, where .. will also point to itself).

>>117704
>how do i include a b c in my code, is it stdin?
No, they're command line arguments. The way to access them will vary depending on which language you're using. For example, in python, they'll be available in sys.argv. See
https://en.wikipedia.org/wiki/Command-line_interface#Arguments
https://en.wikipedia.org/wiki/Entry_point#Programming_languages

Stdin will either contain input read from the keyboard, or piped from another program, for example:
>echo a b c | ./something
Here, "a b c" would be available through stdin.
>>
>>117702
./ is a way for the command line to differentiate between asking it to run a command residing at some directory in your $PATH variable (type "echo $PATH" to see what they are) and asking it to run a specific command somewhere else.

If you specify a path then it will ignore your $PATH variable and just run the program you've specified. If you don't specify a path then it will only search for the program in side the directories defined in your $PATH.


An example might be helpful:
Say you have a program called FOO inside your current directory. Typing "FOO" will result in "command not found" because it doesn't exist in your $PATH directories.
So according to what I said above, you know that in order to specify where the program is you have to supply a path to it. It could be something like
>/home/user/programs/FOO
That will run your program. However, there are shortcuts that make typing paths easier, for example "~" refers to your home directory (/home/user) a ".." refers to the previous directory, and a "." refers to the current directory.
So typing:
>./FOO
would be equivalent to /home/user/programs/FOO in the example above, and that tells the command line to not search $PATH and instead just run FOO from the current directory.
Thread posts: 6
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.