Tagged Questions
1
vote
2answers
42 views
How to strip directory structure with command line (or script)
I have a large collection of files packed into a two-level directory structure with many, many, many folders.
In other words, I have a folder with a great many subfolders in it. There are no ...
2
votes
5answers
103 views
Create and open file with one command?
I want to create a text file and open it in a text editor with a single command.
I know touch file.txt creates a file and open file.txt opens the file, but is there a way to do this with a single ...
2
votes
1answer
37 views
Better way to copy multiple directories to new directory
Is there a better way on the command line to essentially accomplish the following but with a single command
cp -r css/ ar/
cp -r images/ ar/
cp -r js/ ar/
cp -r backups/ ar/
I've just been ...
2
votes
4answers
291 views
Move all files with a certain extension from multiple subdirectories into one directory
Suppose I have a bunch of zip files in several directories:
Fol1/Fol2
Fol3
Fol4/Fol5
And I want to move them all to a common base folder. How would I do this?
1
vote
1answer
29 views
Can one move a relpath in one command?
This question is similar to one I asked recently, but the answers to that question, for the most part, do not extend to this one, AFAICT. The main difference between the two questions is that the ...
1
vote
2answers
90 views
Can one copy a relpath in one command?
I find myself doing this often enough that I wonder if there's a standard Unix way to do it:
% mkdir -p /TARGETDIR/relative/path/to
% cp ./relative/path/to/somefile /TARGETDIR/relative/path/to
In ...
4
votes
8answers
148 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 ...
2
votes
2answers
71 views
A command line utility to visualize how fast a file is growing?
I want to grok how fast a particular file is growing.
I could do
watch ls -l file
And deduce this information from the rate of change.
Is there something similar that would directly output the ...
-2
votes
3answers
137 views
Determine whether a particular file is compressed
How to know in Linux whether a particular file is compressed or not using a command?
3
votes
3answers
79 views
Filesize difference of same name folders
Two different folders, have the same name but they have different filesize. Is there any linux command that can compare two folders and tell me the diff in filesize at the same time?
1
vote
2answers
327 views
ALT+F2 doesnt work in Linux Mint Mate
I am trying to install Sublime Text 2 on Linux MINT (Mate) from this tutorial. http://community.linuxmint.com/tutorial/view/907 and I'm stuck on:
Next , to create a menu icon press Alt+F2 and type:
...
2
votes
2answers
104 views
Sort the output of find before piping to openssh
I'm using this command to recursively generate a SHA-512 hash for each file in a directory hierarchy:
find . -type f -exec openssl sha512 {} \;
I'd like to sort the files in lexicographical order ...
2
votes
3answers
223 views
id3v2 used recursively at command line?
Trying to get my id3 tags cleaned up and am loving id3v2 on the command line -- but I've been using it only with a *.mp3 wildcard and want to explore if there's a way to use it recursively so I can ...
2
votes
1answer
265 views
Regarding generating intersection and union of two csv files
I have two csv files, there are some overlap columns between these two files. Assume one file is called as A.csv and another is called as B.csv. The intersection of A and B is called as C.
I would ...
2
votes
2answers
190 views
How to make duplicates with different names from a single file? [closed]
I want to duplicate the contents of a file. Suppose there is a file named "Hydrogen.element". I want to duplicate the contents of this file with a different name ie.make another file named ...
11
votes
2answers
3k 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 ...
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, ~, ...
3
votes
3answers
124 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 ...
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 ...
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 ...
4
votes
1answer
261 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?
3
votes
1answer
441 views
How to replace a symbolic link with a copy of a file it links to?
Having a (single, no batch filesystem processing needed) symlink, what a command line to use to replace it with a copy of the file it links to?
2
votes
5answers
233 views
Is it possible to reference the most recently modified file in a command line argument?
I frequently download PDF files with heinous numeric file names from my browser. These automatically go into ~/Downloads. Ideally I would like to just be able to open these files with:
evince "the ...
3
votes
2answers
597 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
175 views
gvim -p limit of opened tabs?
When I run :
gvim -p *.xyz
I find that not all files are opened in tabs.
It feels, like a kind of tab limit?
But ! When I try to open unopened with :
:tabnew
it is opened next to previous ...
2
votes
2answers
125 views
Index names of all the files in a plain text file
I've got this directory full of images, and I can do this:
echo *.jpg
image1.jpg image2.jpg image3.jpg # and so on
How can I get the output in a plain text file in this format?
image1.jpg
...
3
votes
2answers
732 views
Obtain .avi file info from command line
What is the best way to obtain information as bitrate, framerate, width/height of an movie file (in my case .avi) from the command line? I am looking for a basic tool that works similarly as ...
4
votes
3answers
267 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 ...
22
votes
6answers
8k 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 ...
2
votes
4answers
189 views
Access the last file (alphabetically) in a directory
I'm trying to open a file with vim from the command line, the file is in a directory filled with automatically generated files that are prepended with a time stamp. Since I don't know the time stamps ...
3
votes
1answer
796 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 ...
3
votes
1answer
141 views
Restricting access to files on an external drive
I was wondering how to restrict access to a specific drive in Unix on the Mac. I was thinking to do this in Terminal where I create a file like this mkfile 6k secure_access. And where secure_access ...
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?
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
...
12
votes
2answers
808 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?