Most Popular
1500 questions
222
votes
1 answer
How to skip "permission denied" errors when running find in Linux?
Possible Duplicate:
How do I remove “permission denied” printout statements from the find program?
When I run this command in Linux (SuSE):
find / -name ant
I get many error messages of the form:
find: `/etc/cups/ssl': Permission denied
Does…
user710818
- 2,459
- 3
- 17
- 12
222
votes
21 answers
How to download portion of video with youtube-dl command?
I am using Ubuntu, and the youtube-dl command is working absolutely fine.
However, now I want to download only a portion a video that is too long. So I want to download only a few minutes of that video, e.g. from minute 13 to minute 17.
Is there any…
user3181614
- 2,321
- 2
- 10
- 6
222
votes
4 answers
What is the purpose of using shift in shell scripts?
I have came across this script:
#! /bin/bash
if (( $# < 3 ));…
Patryk
- 13,556
- 22
- 53
- 61
221
votes
6 answers
Can I redirect output to a log file and background a process at the same time?
Can I redirect output to a log file and a background process at the same time?
In other words, can I do something like this?
nohup java -jar myProgram.jar 2>&1 > output.log &
Or, is that not a legal command? Or, do I need to manually move it to…
djangofan
- 4,002
- 5
- 21
- 19
221
votes
3 answers
Are there naming conventions for variables in shell scripts?
Most languages have naming conventions for variables, the most common style I see in shell scripts is MY_VARIABLE=foo. Is this the convention or is it only for global variables? What about variables local to the script?
Garrett Hall
- 5,121
- 5
- 19
- 12
221
votes
8 answers
How to debug a bash script?
I'm having some problems with some scripts in bash, about errors and unexpected behaviors. I would like to investigate the causes of the problems so I can apply fixes. Is there a way I can turn some kind of "debug-mode" for bash, to get more…
Braiam
- 35,380
- 25
- 108
- 167
221
votes
7 answers
Pass the output of previous command to next as an argument
I've a command that outputs data to stdout (command1 -p=aaa -v=bbb -i=4).
The output line can have the following value:
rate (10%) - name: value - 10Kbps
I want to grep that output in order to store that 'rate' (I guess pipe will be useful…
Paul
- 2,211
- 2
- 12
- 3
220
votes
4 answers
Delete files older than X days +
I have found the command to delete files older than 5 days in a folder
find /path/to/files* -mtime +5 -exec rm {} \;
But how do I also do this for subdirectories in that folder?
Teddy77
- 2,883
- 7
- 23
- 34
219
votes
7 answers
Using sed to find and replace complex string (preferrably with regex)
I have a file with the following contents:
and I need to make a script that changes the "name" in the first line to "something", the…
Harry Muscle
- 2,437
- 2
- 13
- 8
219
votes
12 answers
How do you move all files (including hidden) from one directory to another?
How do I move all files in a directory (including the hidden ones) to another directory?
For example, if I have a folder "Foo" with the files ".hidden" and "notHidden" inside, how do I move both files to a directory named "Bar"? The following does…
Cory Klein
- 18,391
- 26
- 81
- 93
218
votes
12 answers
How to scroll in a terminal using keyboard?
How can I scroll in bash using only the keyboard? If it's not possible in bash, are there any other shells that support this?
Kshitiz Sharma
- 8,585
- 21
- 59
- 75
218
votes
10 answers
How to copy-merge two directories?
I have two directories images and images2 with this structure in Linux:
/images/ad
/images/fe
/images/foo
... and other 4000 folders
and the other is like:
/images2/ad
/images2/fe
/images2/foo
... and other 4000 folders
Each of these…
ssierral
- 2,283
- 2
- 13
- 9
218
votes
6 answers
remove particular characters from a variable using bash
I want to parse a variable (in my case it's development kit version) to make it dot(.) free. If version='2.3.3', desired output is 233.
I tried as below, but it requires . to be replaced with another character giving me 2_3_3. It would have been…
prayagupa
- 4,797
- 12
- 32
- 38
217
votes
17 answers
Any reason NOT to run Linux in a VM all the time?
I've switched to using Arch Linux for most of my day to day work and don't need Windows for anything but gaming and the couple of apps that aren't ported to Linux like OneNote. My Linux distribution is hosted in VirtualBox with Windows as host, and…
Alexandr Kurilin
- 2,481
- 2
- 16
- 13
217
votes
10 answers
How to remove duplicate lines inside a text file?
A huge (up to 2 GiB) text file of mine contains about 100 exact duplicates of every line in it (useless in my case, as the file is a CSV-like data table).
What I need is to remove all the repetitions while (preferably, but this can be sacrificed for…
Ivan
- 17,368
- 35
- 93
- 118