Text file output of directory contents

Clash Royale CLAN TAG#URR8PPP up vote
0
down vote
favorite
My apologies if this has been asked before. I am using Ubuntu 16.04.3 desktop and would like to be able to output the contents (file names) of a directory into a single text file via terminal/cli.
I think when I used to use DOS, years back, went something like this: dir /w/p > file.txt
..think that was it, but simple and damn handy
Thank you for your time and help with my question
files text
add a comment |Â
up vote
0
down vote
favorite
My apologies if this has been asked before. I am using Ubuntu 16.04.3 desktop and would like to be able to output the contents (file names) of a directory into a single text file via terminal/cli.
I think when I used to use DOS, years back, went something like this: dir /w/p > file.txt
..think that was it, but simple and damn handy
Thank you for your time and help with my question
files text
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
My apologies if this has been asked before. I am using Ubuntu 16.04.3 desktop and would like to be able to output the contents (file names) of a directory into a single text file via terminal/cli.
I think when I used to use DOS, years back, went something like this: dir /w/p > file.txt
..think that was it, but simple and damn handy
Thank you for your time and help with my question
files text
My apologies if this has been asked before. I am using Ubuntu 16.04.3 desktop and would like to be able to output the contents (file names) of a directory into a single text file via terminal/cli.
I think when I used to use DOS, years back, went something like this: dir /w/p > file.txt
..think that was it, but simple and damn handy
Thank you for your time and help with my question
files text
files text
asked Feb 18 at 1:46
Sean S
11
11
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
The general command for listing directory contents in Linux is ls
LS(1) User Commands LS(1)
NAME
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
DESCRIPTION
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is speciâÂÂ
fied.
Probably the nearest equivalent to dir /w will be ls -C (the /p option - pause - doesn't really make sense when writing to a file). So
ls -C > file.txt
In fact, there's a dir command in Linux as well - so you could just do dir > file.txt
See Difference between 'dir' and 'ls' terminal commands?
Thank you for your help steeldriver, appreciate it. Very true about the /p option, just so use to using it to pause dir output. Take care and thank you again ;)
â Sean S
Feb 28 at 2:10
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
The general command for listing directory contents in Linux is ls
LS(1) User Commands LS(1)
NAME
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
DESCRIPTION
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is speciâÂÂ
fied.
Probably the nearest equivalent to dir /w will be ls -C (the /p option - pause - doesn't really make sense when writing to a file). So
ls -C > file.txt
In fact, there's a dir command in Linux as well - so you could just do dir > file.txt
See Difference between 'dir' and 'ls' terminal commands?
Thank you for your help steeldriver, appreciate it. Very true about the /p option, just so use to using it to pause dir output. Take care and thank you again ;)
â Sean S
Feb 28 at 2:10
add a comment |Â
up vote
1
down vote
The general command for listing directory contents in Linux is ls
LS(1) User Commands LS(1)
NAME
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
DESCRIPTION
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is speciâÂÂ
fied.
Probably the nearest equivalent to dir /w will be ls -C (the /p option - pause - doesn't really make sense when writing to a file). So
ls -C > file.txt
In fact, there's a dir command in Linux as well - so you could just do dir > file.txt
See Difference between 'dir' and 'ls' terminal commands?
Thank you for your help steeldriver, appreciate it. Very true about the /p option, just so use to using it to pause dir output. Take care and thank you again ;)
â Sean S
Feb 28 at 2:10
add a comment |Â
up vote
1
down vote
up vote
1
down vote
The general command for listing directory contents in Linux is ls
LS(1) User Commands LS(1)
NAME
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
DESCRIPTION
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is speciâÂÂ
fied.
Probably the nearest equivalent to dir /w will be ls -C (the /p option - pause - doesn't really make sense when writing to a file). So
ls -C > file.txt
In fact, there's a dir command in Linux as well - so you could just do dir > file.txt
See Difference between 'dir' and 'ls' terminal commands?
The general command for listing directory contents in Linux is ls
LS(1) User Commands LS(1)
NAME
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
DESCRIPTION
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is speciâÂÂ
fied.
Probably the nearest equivalent to dir /w will be ls -C (the /p option - pause - doesn't really make sense when writing to a file). So
ls -C > file.txt
In fact, there's a dir command in Linux as well - so you could just do dir > file.txt
See Difference between 'dir' and 'ls' terminal commands?
answered Feb 18 at 2:01
steeldriver
63.4k1199167
63.4k1199167
Thank you for your help steeldriver, appreciate it. Very true about the /p option, just so use to using it to pause dir output. Take care and thank you again ;)
â Sean S
Feb 28 at 2:10
add a comment |Â
Thank you for your help steeldriver, appreciate it. Very true about the /p option, just so use to using it to pause dir output. Take care and thank you again ;)
â Sean S
Feb 28 at 2:10
Thank you for your help steeldriver, appreciate it. Very true about the /p option, just so use to using it to pause dir output. Take care and thank you again ;)
â Sean S
Feb 28 at 2:10
Thank you for your help steeldriver, appreciate it. Very true about the /p option, just so use to using it to pause dir output. Take care and thank you again ;)
â Sean S
Feb 28 at 2:10
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1007251%2ftext-file-output-of-directory-contents%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password