All Questions
22 questions
1
vote
2
answers
439
views
Pinning a file to that it appears in the beginning in a folder
I am using Ubuntu (Linux mint). There is a mouse option, if I right-click on a file, I can then choose to pin a file (inside its folder), so that whatever file arranging method (alphabetical, by-date, ...
2
votes
1
answer
2k
views
How to recursively delete the contents of all "node_modules" directories (or any dir), starting from current directory, leaving an empty folder?
Suppose I have a directory structure like this:
projects/
project1/
src/
node_modules/
dir1/
dir2/
dir3/
file
project2/
node_modules/
dir4/
Starting from ...
0
votes
1
answer
437
views
Loop multiple video files to compress them all in one directory?
I'm new to linux. I need some help. I want to compress all files present in a directory with same extension. The output should be with same name and extension. I want to run a shell loop to do this. ...
4
votes
2
answers
14k
views
How do I pass the contents of a multiline file as an argument?
I'm trying to run a script that takes a -t argument. This argument stands for text, and the value -- in theory -- is allowed to be multiline. On the command line, I assume a Here Document would work, ...
-2
votes
1
answer
807
views
Create a counter in a shell script that will increase every time when a file from the current director have more than 8 lines? [closed]
How can I create a counter in a shell script that will increase every time when a file from the current director have more than 8 lines and after how can I generate two lists, one of this with the ...
6
votes
2
answers
2k
views
Emulating "while IFS= read -r line" in bash's C-style for loop
A little context for the question first. The while IFS= read -r line; do ... done < input.txt is a well-known structure for reading a file line-by-line in shell scripting. But having been using c-...
1
vote
2
answers
1k
views
How to perform the mv equivalent of yes | cp -rf on directories?
Using the below directory tree as an example, what is the best way to move the contents of directory/folderA to directory.
How to overwrite a file if a file with the same name exists in the ...
4
votes
1
answer
9k
views
How do I hide warning messages that come from a specific command?
Basically, I want to open the current folder I'm in from terminal. I do gnome-open . from terminal and this opens the current folder I'm in.
In my .bashrc, I have a simple function called open that ...
0
votes
1
answer
32
views
Combine two files having same format based on values of a specific column
I have two files stat_1.txt & stat_2.txt. As follows:
job_id | execution_time
--------+--------------------
12345 | 00:04:42.454282
12346 | 00:03:26.360487
====================
...
0
votes
3
answers
4k
views
How to Delete All the Files in the Current Directory Except the Last Two [duplicate]
Let's say there are 10 files in this current directory /home/usr.
They are numbered 1-10. If I wanted to delete all the files except 9 and 10, how would I go about it?
I can select the bottom two ...
3
votes
1
answer
2k
views
Create a file of fixed size with specific contents
I want to create a file of fixed size (1G, 10G, 100G etc) with a single random word of length within the specified limit on every line. I basically want this to run a benchmark which will sort the ...
2
votes
4
answers
2k
views
Moving and renaming hundreds of .jpg files, all named 5003.jpg
So here's the deal, my girlfriend wants me to transfer all of her photos off from her iPhone onto her laptop (on which we are running Ubuntu 14.04). All of the dedicated programs I tried to do this ...
1
vote
3
answers
1k
views
Bash Command Get Data from multiple files and append the file name
I have in a folder (eg /tmp) the following files
1.id
2.id
3.id
4.id
so on...
In these files, there is one number inside. For example in 1.id it can be the 1000, in 2.id it can be the 2000 etc.
I ...
28
votes
4
answers
35k
views
Why isn't there any shell command to create files?
Attention please:
I am not asking how to make a file from the command line!
I have been using touch for making files for years without paying attention that its main purpose is something else. If one ...
1
vote
1
answer
2k
views
Copy files based on date/time from subset of directories
I'm teaching a class where (~80) students are submitting assignments that I can access via webdav, organized by student in directories named by their unique identifier.
The students are split into ...