So I'm trying to direct a file to be created in another folder (let's say on my Desktop) from my bin
directory. I made a text file with all the files in the directory using ls > textfile
but this only creates the file in the bin
directory, and so I'd like to know how I would direct it to the Desktop straight from bin
?
Asked
Active
Viewed 2,336 times
1

Eliah Kagan
- 117,780

Gabriel A.
- 13
3 Answers
2
You specify a path:
ls > ~/Desktop/textfile
~
is your home directory/
separates components in the path- so to point to something inside your home directory, say
baz
instead inbar
insidefoo
, you do~/foo/bar/baz
.
Also see:
1
Just put ls > path/to/your/desktop/textfile
. A file named textfile
will be created in your desktop.

Ron
- 20,638