Page 1 of 1

why is this command not doing what its mean to?

PostPosted: Fri Feb 19, 2016 1:48 am
by ghostheadx2
Here is my linux command:

Code: Select all
ryan@ubuntu:~/Desktop/destination$ head -n 5 ls-output.txt
ls: cannot access /bin/usr: No such file or directory
ryan@ubuntu:~/Desktop/destination$ ls
lazy_dog.txt  ls-output.txt  output.txt  y       y-link~
ls-error.txt  ls.output.txt  x           y-link
ryan@ubuntu:~/Desktop/destination$ head -n 5 output.txt
ryan@ubuntu:~/Desktop/destination$ tail -n 5 ls-output.txt
ls: cannot access /bin/usr: No such file or directory


I know the file exists, so then why isn't the command working?

It feels like this guy's thread a little bit:

http://askubuntu.com/questions/133389/n ... ile-exists

but I can't possibly have the same problem as him or this guy:

http://unix.stackexchange.com/questions ... can-see-it

But I'm not trying to run a program, other than the commands are obviously programs, but not any actual apps.

-- Fri Feb 19, 2016 1:55 am --

I tried the commands on a file that wasn't empty that it recognized and got different results. So, obviously the programs work.

Re: why is this command not doing what its mean to?

PostPosted: Fri Feb 19, 2016 10:06 am
by -Ninjex-
Give me the output from command:
Code: Select all
alias ls && echo "\r\n" && alias head


It looks more like your head command is wrong or something weird with your terminal. If you run dir and ls-output.txt is there, then everything should be good. You may need to wrap ls-output.txt in single quotes until you can figure out what is wrong... If you rename the file to something else will head work properly on it? Try both 'ls-output.txt' and mv ls-output.txt foo.txt