I would like to join the result of ls -1 into one line and delimit it with whatever i want.
Are there any standard linux commands i can use to achieve this?
Suppose I have some output from a command (such as ls -1):
a
b
c
d
e
...
I want to apply a command (say echo to each one, in turn). E.g.
echo a
echo b
echo c
echo d
echo e
...
What's the easiest way to do that in bash?
Currently I monitoring a particular file with a simple shell one-liner:
filesize=$(ls -lah somefile | awk '{print $5}')
I'm aware that Perl has some nice modules to deal with Excel files so the idea is to, let's say, run that check daily, perhaps with cron, and write the result on a spreadsheet for further statistical use.
i try to check the permission granted to a directory in linux, i mean i have a directory with permission 755
berty@berty-laptop:~$ ls -l / |grep directory
drwxr-xr-x 3 root root 4096 2011-01-10 12:33 directory
how can i read that permission with java? I've tried using FilePermission but though i have a directory with all the permissions (777) the FilePermission class always returns an exception
java.security.AccessControlException: Access denied (java.io.FilePermission /home/directory read)
at java.security.AccessController.checkPermission(AccessController.java:103)
at com.snippets.Check4DirectoryPermission.checker(Check4DirectoryPermission.java:50)
at com.snippets.Check4DirectoryPermission.main(Check4DirectoryPermission.java:70)
is there another way to do this?
I have a command e.g. ls-l file.txt
When there is insufficient space on my drive, the above command just stalls waiting for something to happen. Does anyone know about a code that I could write enabling me to display a message about the lack of space on my drive? E.g. could I use IPC or do you have any other ideas? Thanks in advance.
Concept:
nc -lp 1234 -e fusexmp_server
nc 127.0.0.1 1234 -c "fusestream /mnt/tmp"
Advantages are:
Easy implementation of servers in high level language (without need of any arch-dependent things like JNI or whatever)
Simple ad-hoc networking filesystem out of the box.
Accessibility without actual FUSE (when it is inaccessible):
nc -lp 1234 -e fusexmp_server&
fakefusestream 127.0.0.1 1234
% ls
bin lib usr proc etc
% get /etc/hosts
% exit
Is there already such thing or I should implement it?
I often have a command that processes one file, and I want to run it on every file in a directory. Is there any built-in way to do this?
For example, say I have a program data which outputs an important number about a file:
./data foo
137
./data bar
42
I want to run it on every file in the directory in some manner like this:
map data `ls *`
ls * | map data
to yield output like this:
foo: 137
bar: 42
Problem is located on http://www.preownedweddingdresses.com/
We have a dresses slider at the bottom, select tabs different dresses shown.
Works fine everywhere else, but for some reason, in IE6, the letters "ls" (from the tab "Best Deals") are duplicating inside the content and causing rendering issues.
I've yet to find anything that can fix this, or anything that can be blamed for causing this either.
I've changed the letters at the end of Best Deals, and the duplicated letters change as well.
Open to any suggestions.
Hi,
I have an exam tomorrow and I need some help with these programs. Or if you can tell me where I can get these.
Write a program which uses grep to search a file for a pattern and display search patterns on standard output
Write an awk program to print only odd numbered lines of a file.
Write a program to open the command ls and give the output to the command through which we count the number of files
Thank You :)
I'm a blind student currently in a system admin/shell programming class. Although ssh works fine for executing commands like ls, pwd, etc editors do not work well with my screen reader and an ssh session. I was wondering if it is possible to mount a Linux folder over ssh so it appears as a windows drive? This way I could edit any files I needed to with accessible software and not have to constantly use SCP to send files back and fourth.
I need to allow access to an svn repository using email addresses as the user name. I can log in to the server over ssh no problem by changing the email address "@" to a "$" like so:
ssh [email protected]
Unfortunately, the same does not work for svn+ssh. This gets me nowhere:
svn ls svn+ssh://[email protected]/home/accountname/data/svn/repos
Anyone know how this is usually done?
Is it possible to read binary in ruby file and execute it directly in memory?
for example something like this:
x = IO.read('/bin/ls')
execute(x)
I tried system(x) but it doesn't work
ArgumentError: string contains null byte
I need a script to identify the files opened a particular process on linux
To identify fd :
>cd /proc/<PID>/fd; ls |wc –l
I expect to see a list of numbers which is the list of files descriptors' number using in the process. Please show me how to see all the files using in that process.
Thanks.
I have this code:
#include <stdio.h>
#include <wchar.h>
int main()
{
wchar_t *foo = L"ðh";
wprintf(L"[%ls]\n", foo); return 0;
}
And when I compile it, it gives me the implicit declaration of function ‘wprintf’ warning. I know that I should link the wchar library during compilation, but how do I do that?
Hello,
I'm using a linux server that display directories in a bold font, and files in a normal font.
e.g. $ ls produces
afile.txt afolder anotherfile.txt anotherfolder
I'd like to use this feature on some other servers. How can it be done? with the .bash_profile?
If anyone has other ideas on how to differentiate folders from file, they'd be good to know?
I'm using the Ruby SVN bindings built with SWIG. Here's a little tutorial.
When I do this
@repository = Svn::Repos.open('/path/to/repository')
I can access the repository fine. But when I do this
@repository = Svn::Repos.open('svn://localhost/some/path')
It fails with
/SourceCache/subversion/subversion-35/subversion/subversion/libsvn_subr/io.c:2710: 2: Can't open file 'svn://localhost/format': No such file or directory
When I do this from the command line, I do get output
svn ls svn://localhost/some/path
Any ideas why I can't use the svn:// protocol?
I have a local repository cloned from a bare remote repository. The following command lists al the remote repository's branches.
$ git ls-remote
74bd3eb190edb39db04f6c0c4dbbb9e1e96bc6db refs/remotes/test
85de54d6ae813c624b9623983e6b0a4948dae0fe refs/remotes/trunk
I want to checkout and track that remote's remote branch trunk. How do I do that?
I haven't had a chance to test this script, I'm just using it as a suitable pseudocode. It's just supposed to copy all files in the current directory into a timestamped subdirectory.
ID="$(date +%Y%b%d%H%M%S)"
COMMITABLE="$(ls | egrep --invert-match ^(STATES|PARENT)\$)"
STATE_PATH="$(pwd)/STATES/$ID"
mkdir --parents "$STATE_PATH"
cp $COMMITABLE "$STATE_PATH"
ln -s "$STATE_PATH" PARENT
Suppose I have some output from a command (such as ls -1):
a
b
c
d
e
...
I want to apply a command (say echo) to each one, in turn. E.g.
echo a
echo b
echo c
echo d
echo e
...
What's the easiest way to do that in bash?
Hi,
in C++, using printf I want to print a sequence of number, so I get, from a "for" loop;
1
2
...
9
10
11
and I create files from those numbers. But when I list them using "ls" I get
10
11
1
2
..
so instead of trying to solve the problem using bash, I wonder how could I print;
0001
0002
...
0009
0010
0011
and so on
Thanks
I wonder how to list content of tar file only down to some level?
I understand "tar tvf mytar.tar" will list all files, but sometimes I wish I can just see directories down to some level.
Similarly for command "ls" how to control the level of subdirectories that will be displayed? By default, it will only show the direct subdirectories, but not further.
Thanks and regards
I am having trouble accessing the database while I am developing on the phone. Whenever I execute
cd /data/data/com.mycompck/databases
then if I try to run ls I get opendir failed, Permission denied
Or whenever I type in:
sqlite3 I get sqlite3: permission denied
What I am doing wrong?
Are there some applications that can help me getting a human view of content resolvers values and/or SQLite databases?
I am a beginner in UNIX. I am finding some difficulty in input/output redirection.
ls -l temp
cat temp
Here why temp file is shown in the list and moreover, it is showing 0 characters.
wc temp temp
cat temp
here output is 0 0 0 temp.
Why lines, words, characters are 0.
Please help me to undestand this concept.
I'm looking to combine find . -mtime 0
and ls -lt
To find all files modified in the last day in the current working directory, sorted by last modification date.