why is this command not doing what its mean to?

Discuss the security implications of the various flavors of linux and unix

why is this command not doing what its mean to?

Post by ghostheadx2 on Fri Feb 19, 2016 1:48 am
([msg=91650]see why is this command not doing what its mean to?[/msg])

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.
ghostheadx2
Contributor
Contributor
 
Posts: 728
Joined: Wed Nov 19, 2014 1:19 am
Blog: View Blog (0)


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

Post by -Ninjex- on Fri Feb 19, 2016 10:06 am
([msg=91653]see Re: why is this command not doing what its mean to?[/msg])

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
image
For those that know
K: 0x2CD8D4F9
User avatar
-Ninjex-
Moderator
Moderator
 
Posts: 1691
Joined: Sun Sep 02, 2012 8:02 pm
Blog: View Blog (0)



Return to *nix

Who is online

Users browsing this forum: No registered users and 0 guests