In my opinion, even a simple a.out on the terminal holds complete information about the file being in the current directory. Reiterating it with ./a.out seems superfluous. Why do we need to specify that the file is in current directory to execute it?
6734
While executing a C program, a.out, using the Ubuntu terminal, why do I always need to type ./ before a.out, instead of just writing a.out? Is there solution for this?
59625
while reading about linux file searching I got the following...  To search for files using the * wildcard, replace the unknown string with *, e.g. if you remember only that the extension was .out, type ls *.out  and when I tried the following command on system(ubuntu 14.04 LTS) ..I got   anupam@JAZZ:~$ ls  *.bash*   ls: cannot access  *.bash* : No such file or directory  anupam@JAZZ:~$ ls  .bash*  .bash_history   .bash_logout  .bash_profile  .bashrc  anupam@JAZZ:~$   in the first case why it is showing No such directory ( *.bash* ) and in next case its showing the files ( .bash* )   I am new to this flavor, and according to my automata theory classes (*) means any combination of strings including epsilon(empty),,So why the results are different in both the cases....?
29800
I just want to write a script which changes my directory.  I put the below commands in the file /home/alex/pathABC  #!/bin/sh cd /home/alex/Documents/A/B/C echo HelloWorld   I did   chmod +x pathABC   In the Terminal, while in /home/alex, I ran ./pathABC, but the output is just HelloWorld and the current directory is not changed.  So what is wrong?
28628
For example,   Say I want to list the contents of a folder and directly paste them into a chat window for a friend to see.    I realize I could do ls &gt; filename.txt to create a file (filename.txt) with those contents; I'd then have to open or print the file and manually select and copy the text block (which can be annoying/tedious.)  I clearly could also select and copy the output of ls directly from within the terminal window.  It would be much faster/easier to simply pipe standard output to the clipboard.  What terminal command allows me to do this?
28963
I thought this would be simple - but it is proving more complex than I expected.  I want to iterate through all the files of a particular type in a directory, so I write this:  #!/bin/bash  for fname in *.zip ; do    echo current file is ${fname} done   This works as long as there is at least one matching file in the directory. However if there are no matching files, I get this:  current file is *.zip   I then tried:  #!/bin/bash  FILES=`ls *.zip` for fname in "${FILES}" ; do     echo current file is ${fname} done   While the body of the loop does not execute when there are no files, I get an error from ls:  ls: *.zip: No such file or directory   How do I write a loop which cleanly handles no matching files?
8122
In bash, calling foo would display any output from that command on the stdout.  Calling foo &gt; output would redirect any output from that command to the file specified (in this case 'output').  Is there a way to redirect output to a file and have it display on stdout?
74100
I am new to Ubuntu, and was wondering whether it is posible to open a terminal with a path matching your current location in the file manager? In Windows it was very easy, but how do you do it in Linux?
71137
Given an absolute or relative path (in a Unix-like system), I would like to determine the full path of the target after resolving any intermediate symlinks. Bonus points for also resolving ~username notation at the same time.  If the target is a directory, it might be possible to chdir() into the directory and then call getcwd(), but I really want to do this from a shell script rather than writing a C helper. Unfortunately, shells have a tendency to try to hide the existence of symlinks from the user (this is bash on OS X):  $ ls -ld foo bar drwxr-xr-x   2 greg  greg  68 Aug 11 22:36 bar lrwxr-xr-x   1 greg  greg   3 Aug 11 22:36 foo -&gt; bar $ cd foo $ pwd /Users/greg/tmp/foo $   What I want is a function resolve() such that when executed from the tmp directory in the above example, resolve("foo") == "/Users/greg/tmp/bar".
2907
Simple enough question: is there some shell command (or GUI method) I can use that, given the path to a file on my system, tells me what package put it there? Assuming the file did in fact come from a package, that is.  Bonus question: what if it's a file that isn't installed on my system? Is there, say, a website that will let me look up a file and see what packages, if any, provide it?
105409
My current directory is buried deep in multiple subfolder layers from my home directory.  If I want to open this directory in a gui-based file browser, I have to double click folder after folder to reach it.  This is very time consuming.  On the other hand, with very few key strokes and several times hitting the tab button, it is very easily reachable via a terminal.  I want to know if there is a way to open the current directory in a terminal onto a a file browser.  What is the command to do this?  For reference, I have an ubuntu system, but I'd like to know what the commands are across the various distributions of linux.
81117
I want to redirect the output of the find command to cat command so I can print the data of the given file.   So for example if the output of find is /aFile/readme then the cat should be interpreted as cat ./aFile/readme. How can I do that instantly ?  Do I have to use pipes ?   I tried versions of this :  cat | find ./inhere -size 1033c 2&gt; /dev/null   But I guess this is completely wrong? Of course I'm sure that the output is only one file and not multiple files.  So how can I do that ? I've searched on Google and couldn't find a solution, probably because I didn't search right :P
38314
touch ~/deleted/$(echo "directory_"$(readlink -f foo)|tr '/' '\') 2&gt; /dev/null   where foo is a directory  It's reading the full pathname of foo and creating it as a file replacing all '/' with '\' and putting a directory_ in front so the directory  /home/test/foo would create a file directory_\home\test\foo  It does exactly what I want except a warning keeps printing tr: warning: an unescaped backslash at end of string is not portable   a. I don't know what that means b. I would like it to not show  I tried to redirect stderr to /dev/null but it doesn't work. How do I suppress it?
65256
I am trying to copy the contents of a folder to another folder in a different directory using terminal.  Would somebody be able to provide me an example of the command line syntax required to achieve this?
124182
I want to list all the files, in directory I am currently in, with for example &quot;a&quot; in their name. I know that the first part of the command would be ls -l, but i do not know how to finish it.
114370
This is about files straight from the compiler, say g++, and the -o (outfile) flag.  If they are binary, shouldn't they just be a bunch of 0's and 1's?  When you cat them, you get unintelligible output but also intact words.  If you file them, you get the answer immediately - there seem to be no computation. Do the binary files in fact have headers with this kind of information?  I thought a binary executable was just the program just compiled, only in the form of machine instructions that your CPU can instantly and unambiguously understand. If so, isn't that instruction set just bit patterns? But then, what's all the other stuff in the binaries? How do you display the bits?  Also, if you somehow get hold of the manual of your processor, could you write a binary manually, one machine instruction at a time? That would be terribly ineffective, but very fascinating if you got it to work even for a "Hello World!" demo.
44814
So I'm trying to run foo.exe, but I don't want the output to the terminal but into a file. Running foo.exe &gt; foo.txt should accomplish this for me, but it's not. When I'm running the exe-file, I get the output. The exe is working fine in other words. However, when I try to send the output to a file, the only thing I get is this:  'c:/Program' is not recognized as an internal or external command, operable program or batch file.   This only shows up when I try to send it to a file. Thinking that it could be the path (which is c:\Program Files (x86)\ and so on) which is misinterpreted, I tried specifying the output file like so: foo.exe &gt; c:\test.txt, but still no joy.  So, aside from stating that the binary that I am trying to run is poorly written, is there anything I can do to remedy this? Keep in mind that I do get valid output when simply running the exe, it just won't print nicely to a file. Obviously the output is there, the question is if there is some way to catch it.
35102
When I work in terminal, sometimes I want to open the current directory in a GUI file manager. And then to click the items in the window to run the application. How can I do this?