ls

List all files in remote server using Jsch

China☆狼群 提交于 2019-12-01 07:30:21
问题 I am trying to list all the files/directory from a remote server using JSCH and i can able to get all the information as well.. But my problem is JSCH list all the files with file creation date, time stamp, type of read/write permission etc.., But in my case i need only the file/directory name in the remote server and no additional information's are required.. Below is my piece of java code.. import java.util.Vector; import com.jcraft.jsch.Channel; import com.jcraft.jsch.ChannelSftp; import

Portable way to achieve ls' -v flag (i.e. sort by version)?

泪湿孤枕 提交于 2019-12-01 06:24:42
I'm working on a some build scripts that I'd like to depend on only standardized features. I need to sort some files by version. Say the files are bar-1.{0,2,3} bar-11.{0,2,3}. By default, ls gives me: bar-1_0 bar-11_0 bar-11_2 bar-11_3 bar-1_2 bar-1_3 Getting what I want is easy using 'ls -v': bar-1_0 bar-1_2 bar-1_3 bar-11_0 bar-11_2 bar-11_3 The problem is that 'ls -v' is not standard . Standard sort also seems to lack the option I want, though I could be looking at old versions of the specs. Can anyone suggest a portable way to achieve this effect short of writing my own sort routine?

How to display only files from aws s3 ls command?

走远了吗. 提交于 2019-11-30 16:21:17
问题 I am using the aws cli to list the files in an s3 bucket using the following command (documentation): aws s3 ls s3://mybucket --recursive --human-readable --summarize This command gives me the following output: 2013-09-02 21:37:53 10 Bytes a.txt 2013-09-02 21:37:53 2.9 MiB foo.zip 2013-09-02 21:32:57 23 Bytes foo/bar/.baz/a 2013-09-02 21:32:58 41 Bytes foo/bar/.baz/b 2013-09-02 21:32:57 281 Bytes foo/bar/.baz/c 2013-09-02 21:32:57 73 Bytes foo/bar/.baz/d 2013-09-02 21:32:57 452 Bytes foo/bar/

what does terminal command: ls -l show?

拈花ヽ惹草 提交于 2019-11-30 12:31:02
问题 I know that it outputs the "long" version but what do each of the sections mean? On my mac, when I type in ls -l /Users I get total 0 drwxr-xr-x+ 33 MaxHarris staff 1122 Jul 1 14:06 MaxHarris drwxrwxrwt 8 root wheel 272 May 20 13:26 Shared drwxr-xr-x+ 14 admin staff 476 May 17 11:25 admin drwxr-xr-x+ 44 hugger staff 1496 Mar 17 21:13 hugger I know that the first line it the permissions, although I don't know what the order is. It would be great if that could be explained too. Then whats the

How do I capture the output from the ls or find command to store all file names in an array?

人盡茶涼 提交于 2019-11-30 07:53:30
Need to process files in current directory one at a time. I am looking for a way to take the output of ls or find and store the resulting value as elements of an array. This way I can manipulate the array elements as needed. To answer your exact question, use the following: arr=( $(find /path/to/toplevel/dir -type f) ) Example $ find . -type f ./test1.txt ./test2.txt ./test3.txt $ arr=( $(find . -type f) ) $ echo ${#arr[@]} 3 $ echo ${arr[@]} ./test1.txt ./test2.txt ./test3.txt $ echo ${arr[0]} ./test1.txt However, if you just want to process files one at a time, you can either use find 's

what does terminal command: ls -l show?

徘徊边缘 提交于 2019-11-30 04:33:00
I know that it outputs the "long" version but what do each of the sections mean? On my mac, when I type in ls -l /Users I get total 0 drwxr-xr-x+ 33 MaxHarris staff 1122 Jul 1 14:06 MaxHarris drwxrwxrwt 8 root wheel 272 May 20 13:26 Shared drwxr-xr-x+ 14 admin staff 476 May 17 11:25 admin drwxr-xr-x+ 44 hugger staff 1496 Mar 17 21:13 hugger I know that the first line it the permissions, although I don't know what the order is. It would be great if that could be explained too. Then whats the number after it? Basically, what do each one of these things mean? Why are the usernames written twice

pass output as an argument for cp in bash [duplicate]

ε祈祈猫儿з 提交于 2019-11-30 01:26:21
This question already has an answer here: How to pass command output as multiple arguments to another command 4 answers I'm taking a unix/linux class and we have yet to learn variables or functions. We just learned some basic utilities like the flag and pipeline, output and append to file. On the lab assignment he wants us to find the largest files and copy them to a directory. I can get the 5 largest files but I don't know how to pass them into cp in one command ls -SF | grep -v / | head -5 | cp ? Directory It would be: cp `ls -SF | grep -v / | head -5` Directory assuming that the pipeline is

Finding executable files using ls and grep

微笑、不失礼 提交于 2019-11-29 22:15:14
I have to write a script that finds all executable files in a directory. So I tried several ways to implement it and they actually work. But I wonder if there is a nicer way to do so. So this was my first approach: ls -Fla | grep \*$ This works fine, because the -F flag does the work for me and adds to each executable file an asterisk, but let's say I don't like the asterisk sign. So this was the second approach: ls -la | grep -E ^-.{2}x This too works fine, I want a dash as first character, then I'm not interested in the next two characters and the fourth character must be a x. But there's a

Cygwin ls command not found [closed]

北城以北 提交于 2019-11-29 20:23:38
This is a question that I self-answered on my tech blog where I keep the tech-tips which I need to give to myself from time to time, so I decided to move it over here instead. The original blog post is here: http://thehacklist.blogspot.com/2009/04/cygwin-ls-command-not-found.html If you are a linux enthusiast and really miss those greps and sed/awks on the windows box, you've probably installed cygwin . You tried running it either by double-clicking the cygwin icon on your desktop or the cygwin.bat file in your C:\cygwin directory and got the bash-3.X$ prompt. However, although the pwd or cd

How do I list one filename per output line in Linux?

[亡魂溺海] 提交于 2019-11-29 18:50:42
I'm using ls -a command to get the file names in a directory, but the output is in a single line. Like this: . .. .bash_history .ssh updater_error_log.txt I need a built-in alternative to get filenames, each on a new line, like this: . .. .bash_history .ssh updater_error_log.txt Bert F Use the -1 option (note this is a "one" digit, not a lowercase letter "L"), like this: ls -1a First, though, make sure your ls supports -1 . GNU coreutils (installed on standard Linux systems) and Solaris do; but if in doubt, use man ls or ls --help or check the documentation. E.g.: $ man ls ... -1 list one file