0

I'm currently using Ubuntu 14.04.1 LTS on both desktop and laptop.

I've been using Ubuntu for a couple of years and recently took the courage to buy a book about commands in Linux, but I've found a problem that has been bugging me for days now.

The book presents the file command written on the terminal as:

$ file picture.jpg

But when I type file whatever the message ERROR: cannot open 'whatever' (No such file or directory) appears.

I've tried to type the file with and without the extension. I've tried on both PCs, even naming a .jpg file picture to replicate the results shown in the book. No results.

Am I writing the command wrongly? Is this book outdated for Ubuntu 14.04.1?

  • Try using tab completion about half-way through the file name (e.g. file whate{tab}{tab}) see if that outputs anything – Grammargeek Jul 5 '15 at 16:42
  • I tried the command "file picture.jpg" first with the file on the "Documents" directory and then on "Home". Checked the working directory both times with "pwd" and it was "/home/user" – Candren Jul 5 '15 at 16:43
  • press tab after typing file picture.jp see if there's any output – Grammargeek Jul 5 '15 at 16:44
  • Now it worked! Thanks! Any idea why I couldn't make it work before? By the way, should I change the working directory every time I want to use the file command or is there any way to make it work regardless of the directory the file is into? – Candren Jul 5 '15 at 16:49
  • 1
    To make it work regardless of working directory use a Non-Relative path (such as file /home/Candren/picture.jpg) (Like how I made it look like a textbook?) – Grammargeek Jul 5 '15 at 16:54
0

Press tab right before the end of the command (i.e. file picture.jp{TAB} where it says {TAB} press tab)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.