Unix command equivalent in Windows Powershell [closed] - shell

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
what is the equivalent of command ls -la in Windows Powershell?

Get-ChildItem -Force will reveal hidden items, but the format of -la isn't directly mirror-able in powershell though as it returns objects rather than a string, use Select x,y,z to get the details you're looking for.

Not in correct order for the -l-switch, but this will get you started:
ls -force|Select-Object attributes, fullname, length, LastAccessTime, LastWriteTime, CreationTime, #{N='Owner';E={$_.GetAccessControl().Owner}}|Format-Table
To see which properties are available for select-object you can use the following:
Get-ChildItem -force|Get-Member -MemberType Properties
And as stated by Clijsters in the comments: If you are using linux, ls might not be an valid Powershell alias, so use Get-ChildItem or gci.

Related

Why doesn't "ls -ad */" show both hidden and non-hidden directories? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed last year.
Improve this question
Why doesn't the command:
ls -ad /*
...show both hidden and non-hidden directories? And given this does not work, what would be the simplest command for showing hidden and non-hidden directories, without showing files?
Thanks!
/* is expanded by the shell before ls ever runs. The expansion only includes non-hidden files unless the dotglob option is set. Also, if you want the expansion limited to directories, use /*/ instead.

ag and rg not listing files starting with underline, find does [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
If I do:
touch _gandalf
And then:
rg --files | grep gandalf | wc -l
or
ag -l -g "" | grep gandalf | wc -l
I get 0 matches as result.
Now if I do a touch gandaf I get 1 match.
Why is that? Does files starting with underline have a similar behaviour as hidden files? Maybe is something on mac's filesystem? As mentioned on the title if I replace ag/rg for find . it works as expected.
In my case was my global .gitignore having a clausule to exclude files starting with underlines.
But I think is useful to keep in all this files (as mentioned on the comments):
.gitignore
.ignore
.rgignore
.agignore

get folder address from text file for copy file ( by command ) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I'm tray to save (folder address) to a text file and i want copy file to this address ,
is there any way to use copy command read this text address and copy file to the address
i want make a copy batch program for copy my file to several address in my pc but get the address from a text file , Addresses are not fixed and often change.
Like this ?
get-content text_path.txt | foreach { copy file.txt -dest $_ }
It's not quite clear, what your problem is, but this may help you:
to write something to a file use
echo this is my text>file.txt
to read it back into a variable use
set /p "var="<file.txt
Then you can use it:
echo I have read: %var%
Note: this is the simplest way to do it, but it works only with "one-line-files" - exactly, what you need (according to your description)

DIR Command in Windows Command Line [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
How do I use the DIR command to list all directories, including subdirectories, that contain no files? I've researched this at length and can only find how to DELETE the specified directories, but not actually list them. Can anyone help? Is there a better way other than the DIR command?
You could modify the Powerscript answer on the linked question to display instead of delete like this:
Get-ChildItem -Recurse . | where { $_.PSISContainer -and #( $_ | Get-ChildItem ).Count -eq 0 } | Select-Object -Property FullName

What's the meaning of every part of a bash prompt? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
i'm very new to mac world, and i'm using bash doing some work.
But I'm not clear about the bash command line. It's so different from cmd.
yb_server:~ Aaron$
above is the command line when i start a terminal.
what's the meaning of yb_server?( I used to remember it's originally macintosh, why
it's changing to yb_server, how can i recover?)
what does ~ mean?
what does $ mean?
yb_server is your computer.
: is an arbitrary delimiter.
~ is your home directory (the current directory).
Aaron is you.
$ is "Speak to me, master!" But it is effectively an arbitrary delimiter.
The whole thing is your prompt. Google "bash prompt" for lots of info. Its format is totally up to you. Say echo $PS1 to find out what the format is now. The default is:
\h:\W \u\$
Learning what those symbols mean is left as an exercise for the reader!

Resources