Tagged Questions
22
votes
6answers
7k views
How can I edit multiple files in VIM?
I know I can open multiple files with vim by doing something like vim 2011-12*.log, but how can I switch between files and close the files one at a time? Also, how can I tell the file name of the ...
12
votes
2answers
786 views
How can I count the number of different characters in a file?
I would need a program, that outputs the number of the different characters in a file. Example:
> stats testfile
' ': 207
'e': 186
'n': 102
Exists any tool, that do this?
12
votes
1answer
2k views
ls taking long time in small directory
Running Ubuntu, I open a terminal and do
sudo bash
cd /
ls | head -n 1000
And predictably about 20 directories are returned.
However, if I do an ls, and don't pipe it into anything, the ls just ...
11
votes
2answers
2k views
How tell gzip to keep original file?
I would like to compress a text file using gzip command line tool while keeping the original file. By default running the following command
gzip file.txt
results in modifying this file and renaming ...
9
votes
4answers
4k views
What's the best way to join files again after splitting them?
If I have a large file and need to split it into 100 megabyte chunks I will do
split -b 100m myImage.iso
That usually give me something like
xaa
xab
xac
xad
And to get them back together I have ...
8
votes
3answers
6k views
Linux ls to show only filename date and size
How can I use ls in linux to get a listing of filenames date and size only. I don't need to see the other info such as owner or permission. Is this possible?
8
votes
2answers
1k views
Locate and delete all temporary files in user directory
I use vim a lot, and my area has power failure a lot. So the resultant is I get many *.swp files scattered over my PC.
I want an alias of rm command that removes all files with either .swp, ~, ...
6
votes
6answers
5k views
Efficiently delete large directory containing thousands of files
We have an issue with a folder becoming unwieldy with hundreds of thousands of tiny files.
There are so many files that performing rm -rf returns an error and instead what we need to do is something ...
5
votes
3answers
2k views
Show contents of many files
From the command line, what is the easiest way to show the contents of multiple files? My directory looks like below.
./WtCgikkCFHmmuXQXp0FkZjVrnJSU64Jb9WSyZ52b
...
4
votes
8answers
143 views
Run a command on all subfolders
If you have a series of subfolders (like from a to z) and want to run a command on each one of them (like rm *.pdf or ls *.pdf), how do you do that? The "manual" approach would be cd a, rm *.pdf, or ...
4
votes
1answer
257 views
How to replace a symbolic link with an equivalent hard link?
Having a (single, no batch filesystem processing needed) symlink, what a command line to use to turn it into a hard link to the same file?
4
votes
3answers
257 views
Shortcut for fast recursive removal
Sometimes I want to delete large swaths of temporary files recursively, and recycle the directory name without waiting for the command to complete. (For example, if I want to nuke and re-checkout a ...
3
votes
3answers
121 views
Regarding separate a single file into multiple files according to line separation
Currently, I have a plain text file, A, such as
lowest priority
very high significance.
outstanding
very novel
In this file, every line contains a sentence. I want to separate this file into ...
3
votes
2answers
582 views
How to execute one command on all files within a folder
Saying, I have this tree and I want to execute ruby on all scripts within the folder. How could I archive through one line of command.
./
../
rb-script/
sample1.rb
sample2.rb
3
votes
1answer
779 views
How do I enable locate and queue the database to be built?
On a new Ubuntu 10.4 instance, I tried to use the locate command only to receive the error
locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
from using this command ...