date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,473,661,284,000 |
what's the stand-alone hyphen (between the -C & -O) stand for in this command?
curl -C - -O http://www.intersil.com/content/dam/Intersil/documents/fn67/fn6742.pdf
FWIW- I'm following a tutorial here.
|
-C - automatically determines how to resume the transfer, based upon the input and output files.
From man curl (note the second paragraph):
-C/--continue-at <offset>
Continue/Resume a previous file transfer at the given offset.
The given offset is the exact number of bytes that will be
... | what does Curl's stand-alone hyphen (-) mean? |
1,473,661,284,000 |
I'm trying to disable some services from starting at boot time on my Linux Mint 12 laptop.
So I installed chkconfig, which has worked great for me before on Fedora.
However, on Linux Mint 12, it gives me tons of errors. Here is an example, trying to disable the rsync service:
$ sudo chkconfig rsync off
insserv: warnin... |
Since it is an ubuntu based distro you can also use update-rc.d.
update-rc.d rsync remove
or install rcconf wich is a really nice text-based user interface
| Chkconfig on Linux Mint 12 giving tons of errors |
1,473,661,284,000 |
I'm used to commands supporting multiple filename arguments if possible, but unlink doesn't:
%> unlink a b
unlink: extra operand `b'
Try `unlink --help' for more information.
I ended up using a for loop. Is there a technical reason why unlink only takes one filename?
|
unlink(1) is an intentionally simplified variant of rm(1).
I'm not certain why it was created, but it's probably due to the fact that under the hood, rm(1) is implemented in terms of the unlink(2) system call. Therefore, I assume the reason for unlink(1) is to provide a more direct path to the system call. Someone dou... | Why does unlink(1) support only one file? |
1,473,661,284,000 |
How can I notify all online (Desktop) users from the command-line?
I know that if I want that I get notified when something is done, I just do like this:
sudo apt-get update | notify-send "apt-get update" "update finished"
What should I use to notify all users (or some specific user)?
|
You can try wall. On my KDE machine, a small panel pops up with the message sent with wall. Of course, the message also appears in all terminals, but maybe your users do not have a terminal open. Example:
echo "It is 9 o'clock and all is well." | wall
| CentOS: Alert all desktop users from command-line |
1,473,661,284,000 |
Is there a commandline tool for GNU/Linux which will analyse download and upload speed, packet-loss, latency and other factors which will indicate internet connectivity status?
|
You can use iftop to show bandwidth usage.
| Commandline tool for comprehensive and integrated testing of internet connectivity |
1,473,661,284,000 |
I've a sequence of commands to be used along with lot of pipings, something like this:
awk '{ if ($8 ~ "isad") {print $2, $5, "SE"} else {print $2, $5, "ANT"} }' "/var/log/apache2/other_vhosts_access.log" | grep -v '127.0.0.1' | tr '[' '\0' | tr [:lower:] [:upper:] | sort -t' ' -s -k3
This basically filters the Apach... |
The different parts can be put in shell functions :
awkfilter() {
awk '{ if ($8 ~ "isad") {print $2, $5, "SE"} else {print $2, $5, "ANT"} }'
}
toupper() {
tr '[:lower:]' '[:upper:]'
}
dosort() {
sort -t' ' -s -k3
}
awkfilter < /var/log/apache2/other_vhosts_access.log |
grep -vF 127.0.0.1 |
tr '[' '\... | How to build a long command string? |
1,473,661,284,000 |
I would like to create a file that just contains a binary number. I think that touch can be used to create an empty file, but is there any way I can fill it with a binary number e.g. 10 (ten)? And how can I validate that the file contains the binary value of ten?
See also How can I check the Base64 value for an intege... |
Convert the number to hex (in this case A) and then do:
echo -en '\xA' > file
| How can I create a file that just contains a binary number? |
1,473,661,284,000 |
When I do:
display file.pdf
it shows this:
I can't resize the little window that it adds but I can remove it by clicking on the x. I can also remove the checkerboard effect that comes from assuming transparency, I think, with:
display -alpha opaque file.pdf
The text is now rough and slightly hard to read. It seems... |
You need to remove the alpha channel, rather than making it opaque — this will render the alpha information correctly (including anti-aliasing), then remove it.
display -alpha remove file.pdf
The small window shown above the main window is used to scroll around the document.
| How to get display to show a pdf properly |
1,473,661,284,000 |
I have a some tree.
.
├── 1
│ └── a
│ └── script.a.sh
├── 2
│ └── a
│ └── script.b.sh
...
└── a
└── script.sh
And I need to find script.*.sh. I execute ./a/script.sh:
#!/bin/bash
#
path="/tmp/test"
readarray files < <(find ${path} -path "*/a/script.*.sh")
if [ ${#files[@]} -ne 0 ]
then
for f... |
But if I change find command to find ${path} -path "*/a" -name "script.*.sh" the script does output nothing.
Indeed, it must not. A file matching the predicate -path "*/a" cannot also match the predicate -name "script.*.sh".
My logic find all files with pattern /tmp/test/*/a/script.*.sh what
I say with find ${p... | find -name -path |
1,473,661,284,000 |
There are lots of questions/answers explaining what characters one shouldn't use in Linux filenames etc.
I am looking for a non-alpha/numeric character that I can put at the front of a filename to bump it to the top of an ls without requiring escape characters to handle it on the command line.
In macOS I use <Filename... |
Without knowing it, you've asked two very complicated questions... quoting and sorting.
Sort order is determine by locale. What comes first is... not fixed.
e.g.
$ touch Hello hello There there
$ LANG=C ls -1
Hello
There
hello
there
$ LANG=en_US ls -1
hello
Hello
there
There
The next is the quoting question. This ... | Is there a character in Linux that can be used at start of a filename to bump it to the top in regular sort order but doesn't require escaping etc? |
1,473,661,284,000 |
This:
Save all the terminal output to a file
Except after the fact. Meaning that instead of preparing to record or pipe all output to a file, I am dealing with output that has already taken place, and that I omitted to record to a file. Rather than to spend minutes scrolling up 7000 lines of output, copying and pastin... |
With konsole, File->Save output as works as does CTRL-SHIFT-S, but you will only save what is in the buffer.
| Save all terminal output to a file, after the fact |
1,473,661,284,000 |
I hope this isn't a duplicate, but I did some due diligence trying to find and answer. I want to pipe the original output to a second command, only if the first command fails.
e.g. cat file.txt | command1 || command2 Where both command1 and command2 read from STDIN.
I want command1 to read everything from cat file.txt... |
Welcome to Stack Exchange! Lot's of good info here. Thank you for your due diligence first.
The issue I see with your command is that it is "Begging the Question." In other words, it assumes you know the answer before you even start.
Let's have a closer look:
cat file.txt
The contents of "file.txt" will go to STDOUT... | How do I pipe to a command only if another command fails (keeping the original input)? |
1,473,661,284,000 |
I'ld like to hide ugly data from being shown by command line tools like cat (and maybe simple text editors too) which often get confused by binary data. For example a VT100 terminal sometimes gets misconfigured by binary outputs.
<?php
// PHP code shown by text tools on the command line
__halt_compiler();
// here so... |
One 'solution' would be to use the alternative screen buffer which many (but not all) terminals support. Consider the following command:
printf "Hello, \e[?1049h ABCDEFG \e[?1049l World\n"
On a terminal supporting alternative screen buffers, you would see
Hello, World!
possibly with a very sudden flash of the termi... | Is there any control character or hack to prevent simple command line tools from showing subsequent data? |
1,473,661,284,000 |
I have to run this cryptic block of code.
git clone https://github.com/OpenICC/xcalib.git
cd xcalib
cmake CMakeLists.txt
sudo make install
The procedure I'm following mentions the uninstall process.
sudo make uninstall
Why do the make install and uninstall commands lack any file or program name? In my mind they sho... |
The commands that are executed by make install (or any invocation of make) are defined in the Makefile (and files included by the Makefile). For simple programs, you can just look for a line install: and see the commands in the lines below. But makefiles can also be quite complicated and scattered across various subdi... | sudo make install - what is being installed? |
1,473,661,284,000 |
Say I have written the following command but haven't yet pressed enter to execute it:
$ ls dir1 dir2 dir3
Is there a way to replace given characters without manually changing them in every location they are? For example, I'd like to press some shortcut, enter string to be replaced (say, dir) and then enter another st... |
There's a replace-string autoloadable widget for that. Add to your ~/.zshrc:
autoload replace-string
zle -N replace-string
zle -N replace-string-again
bindkey '\eg' replace-string-again
bindkey '\er' replace-string
Then press Alt+r to invoke. Alt+g to repeat the last substitution. See info zsh replace-string for deta... | Replace string in command to be executed in zsh |
1,473,661,284,000 |
I'm using the default ksh on OpenBSD 6.2 (based on pdksh) with Vi command line editing mode enabled.
I'm trying to get the arrow keys to work properly as a complement to h, l, j and k (as I'm on a Dvorak keyboard). As far as I can tell, they don't work at all. It does not matter whether I'm in "input" or "command" mo... |
I did a quick foray into /usr/src/bin/ksh on my OpenBSD system, seeing as I had the actual sources checked out anyway. I had a cursory glance at c_ksh.c, emacs.c and vi.c and it looks as if the Vi mode was retrofitted into pdksh from nsh at some point (around 1989/1990). The exact words used are
/* $OpenBSD: vi.c... | Arrow keys in OpenBSD's ksh, command line editing, Vi-mode |
1,473,661,284,000 |
Consider a directory with the following files.
20160909_154139.jpg
20160909_154038.jpg
20160909_153929.jpg
20160909_153927.jpg
20160908_121201.jpg
20160908_121155.jpg
When I do ls with no arguments, I get the files in the order above.
Let's say instead I just wanted the files in this order between 20160909_154038.jp... |
That can certainly be achieved by piping the output into awk
ls | awk '/^20160909_154038\.jpg$/,/^20160908_121201\.jpg$/'
| Is it possible to list the files between two names alphanumerically? |
1,473,661,284,000 |
This question is related to https://askubuntu.com/q/826288/295286 In my search online, I could find no mention of whether bash 3.2 comes with readline support. Thus, I would like to know, if there is a systematic way of finding out what libraries bash uses.
In the linked question , I used locate to search for readlin... |
This is probably a duplicate (I recall it being answered). But:
bash bundles readline, and
will use the bundled version of readline unless
it is specially configured, and
the bundled version is statically linked, so
you are unlikely to see it as a shared library dependency of bash.
For example:
$ ldd /bin/bash
... | How to know if bash has readline library support? |
1,473,661,284,000 |
I am using this
for d in ./*/ ; do (cd "$d" && cp -R ../lib . ); done
in a shell script to copy lib folder in all subfolder inside my parent directory . But the lib folder also getting copied inside lib . How to avoid that ?
|
Without extglob:
for d in */ ; do
if [ "$d" != "lib/" ]; then
cp -R lib "$d"
fi
done
Or just delete it afterwards... (well, unless lib/lib exists beforehand!)
for d in */; do cp -R lib "$d"; done
rm -r lib/lib
(Somewhat amusingly, GNU cp says cp: cannot copy a directory, 'lib', into itself, 'lib/lib'... | How to copy using for loop? [duplicate] |
1,473,661,284,000 |
let's say I have these two commands:
$ cat file1
file1_a
file1_b
file1_c
file1_d
And:
$ cat file2
file2_a
file2_b
file2_c
file2_d
How can I combine these outputs using a custom separator (e.g. ...) so that I get the following output:
$ # some fancy command like { cat file1 & cat file2 } | combine --separator='...'
... |
I like to use the paste command.
paste -d. file1 - - file2 < /dev/null
produces desired output
file1_a...file2_a
file1_b...file2_b
file1_c...file2_c
file1_d...file2_d
- refers to stdin, we use this twice to triple our dots </dev/null is used because we do not want anything between those dots.
| How to combine two command outputs line by line? [duplicate] |
1,465,559,211,000 |
ls command shows the following :
a code controller.js mani sparat this ubuntu.gif
l command the shows similar to that :
a/ code/ controller.js mani/ sparat/ this/ ubuntu.gif
What is difference between them ?
|
l is probably a shell alias. On my Ubuntu 14.04 by default it is :
alias l='ls -CF'
From the man ls page, these flags mean :
-C list entries by columns
-F, --classify
append indicator (one of */=>@|) to entries
Type alias l to find out what actually the l command is calling.
| what is difference between l and ls commands [duplicate] |
1,465,559,211,000 |
Is it possible for bash to find commands in a case-insensitive way?
eg. these command lines will always run python:
python
Python
PYTHON
pyThoN
|
One way is to use alias shell builtin, for example:
alias Python='python'
alias PYTHON='python'
alias Python='python'
alias pyThoN='python'
For a better approach, the command_not_found_handle() function can be used as described in this post: regex in alias.
For instance, this will force all the commands to lowercase:... | bash case-insensitive commands matching |
1,465,559,211,000 |
From terminal, how can I print to output a specific section of the result of man something?
For example, if I wanted to get some information about the return value of the C function write, I'd like to see something like this:
RETURN VALUE
On success, the number of bytes written is returned (zero indicates
... |
To quote my own post from Meta:
Linking to man pages
I already have a favored method for this, which you can read about in the less man page in two places:
LESS='+/\+cmd' man less
and
LESS='+/LESS[[:space:]]*Options' man less
(See what I did there?)
| How can I print a section of a manual (man)? |
1,465,559,211,000 |
When trying to copy a file from Linux (Raspbian to be precise, though I don't think it matters) to Windows using SCP:
scp a.txt {user}@{ip}:\C\Users\{user}\a.txt
The file is copied, but to C:\Users\{user}\CUsers{user}a.txt.
It looks as if I need to escape the '\' somehow, but couldn't figure out how.
|
While I have never used scp on Windows, so I am only guessing, it certainly looks like the backslashes are ignored. Or, rather, as if they are taken as escape characters and, since they don't escape anything relevant, are being ignored. Consider this, on a Linux machine:
$ cd \usr\share
bash: cd: usrshare: No such fil... | Why the defined path is used as file name when I transfer files through scp to a Windows host? |
1,465,559,211,000 |
Lets say there's a string like this
test="1/2/3 4/5/6 7/8/9/0"
They are separated by spaces, as well as '/'.
I want to return a result like this by taking the second field of each string segment.
2 5 8
Is it possible to do this with cut? Or do I need something else?
newstring=$(echo $test | cut -d "/" -f2)
returns ... |
One thing you could do is replace spaces with newlines and then use awk or cut. Then, replace newlines with spaces. You'll want to echo the entire thing to get a final newline again:
$ echo $(echo "$test" | tr ' ' '\n' | awk -F'/' '{print $2}' | tr '\n' ' ')
2 5 8
Or
$ echo $(echo "$test" | tr ' ' '\n' | cut -d/ -f 2... | How do I cut a string already separated by spaces? |
1,465,559,211,000 |
I have something like:
find . -type f -print0 | xargs -0 file | grep Matroska | cut -d: -f 1-1 | xargs rm
I want something like:
find . -type -f -filemagic "Matroska" -delete
|
-exec indeed can be used as a predicate. find(1):
Execute command; true if 0 status is returned.
So this example would be:
find . -type f -exec sh -c 'file "$0" | grep -q Matroska' '{}' ';' -and -delete
Obviously, instead of -delete there can be -ls or -print0 or more predicates.
| How can I turn `file` tool into a predicate for `find`? |
1,465,559,211,000 |
I'd like to see how long it takes a certain app to fully start.
Is there a way to do this launching the app via terminal using some command?
|
There's no standard definition for “fully start”. If you come up with a definition, there may or may not be a way to detect it.
If your definition of “fully start” is “wait until the application becomes idle, waiting for user input”, then you can trace its system calls and look how long it takes to start reading user ... | Timing start up time for app launched via terminal command |
1,465,559,211,000 |
I have a large number of files that contain backslashes \ that I would like to manipulate, but whenever I try something like:
$ ls -li
2036553851 -rw-rw-r-- 1 user user 6757 May 20 00:10 Simplex_config\\B1:B3\\_1.csv
2036553766 -rw-rw-r-- 1 user user 6756 May 20 00:07 Simplex_config\\B1:B3\\_2.csv
2036554099 -rw-rw-r-... |
1.
find . -type f -name 'Simplex*.csv' -print0 | xargs -0 cat > looksee.txt
From man xargs
--null
-0
Input items are terminated by a null character instead of by whitespace, and the quotes and backslash are not special (every character is taken literally). Disables the end of file string, which is tre... | Manipulate multiple files by inode |
1,465,559,211,000 |
I have multiple sub-directories each with different depths. I need to search for the last occurrence of a string in a specific file type (say *.out). How can I accomplish this?
I have tried:
grep -r 'string' **/*.out | tail -1
But that gives me only the last string of the last file.
|
I will use something like:
for i in `find . -name "*.out" -type f`;
do
grep -l 'string' $i
grep 'string' $i|tail -1
done
With 1st grep you will have filename and below (second grep) the content.
This works as long as the file names don't contain whitespace or \[*?. See cuonglm's answer for a robust solution.
| Find the last occurence of a string in a given filetype in all subdirectories |
1,465,559,211,000 |
In the man pages it says:
-C list entries by columns
However, I really cannot notice any difference between the output of ls or ls -C, could someone explain this to me?
|
To add what @muru said in the comments; have a look at info coreutils ls
`-C'
`--format=vertical'
List files in columns, sorted vertically. This is the default for
`ls' if standard output is a terminal. It is always the default
for the `dir' program. GNU `ls' uses variable width columns to
displ... | What does the option -C achieve in ls output? |
1,465,559,211,000 |
I have directories set up a bit like this
~/code
~/code/src
~/code/build -> /path/to/somewhere/else
That last one's a symlink.
If I do this
cd ~/code/build
ls ..
then I get the listing for /path/to/somewhere, but from other remarks and my own experience, I'd expected to see the listing for ~/code -- I'd swear that t... |
Not the issue of ls. It's how symlinks work. The .. gets you into the parent of the current directory, the directory doesn't know you got to it through a symlink. The shell has to intervene to prevent this behaviour. For the shell builtin cd, there is special handling that doesn't just call chdir but memorizes the ful... | ls .. doesn't work properly with symlinks |
1,465,559,211,000 |
I am developing an API in Unix environment for virtual machines. Most of the modules are developed in python. I have few questions on this.
I have the file extension as abc.py. I would like to make this as a command. For example , virtman dominfo [vmid] should be the command syntax. Now I have to give ./virtman.py dom... |
You seem to be mistaken in that abc.py would not be a command. If you can execute it, then is, just one with a dot in the name. Execute in the sense that you can do ./abc.py, so the execute bits must be set. If you have to do python abc.py than you it is not a command (yet).
In general, to make a normal python file a... | Basic steps to develop python API in Unix environment |
1,465,559,211,000 |
I have, in the same directory, several odt files.
I'd like to have in one PDF document the first page of these odt files, sorted alphabetically based on their filename.
For example, if I have these files:
a.odt
b.odt
c.odt
I would have a resulting PDF that has 3 pages: the first one of a.odt, then the first one of b... |
#!/bin/bash
for i in *.odt; do
echo "Converting [ $i ]"
unoconv -f pdf "$i"
echo "Extracting 1st page of [ $i ]"
i="${i%odt}pdf"
pdftk P="$i" cat P1-1 output "$i".1
done
echo "Merging pdfs"
pdftk *.1 cat output result.pdf
rm *.1
You have to install unoconv and pdftk.
Ubuntu: sudo apt-get install unoconv pdf... | Concatenate in a PDF the first page of several odt files alphabetically |
1,465,559,211,000 |
Is there some way to change the current url (of current tab or an specific tab) of a running web browser (any) thru command line?
It can be any browser that run on Linux, preferably if it is light weight.
I don't mean to close and re-open the browser.
I was only able to open new tabs on browsers but not change the cur... |
In Firefox you can use MozRepl addon to control Firefox via telnet. For example, to change current url of a current tab to http://v4.ident.me:
(echo "content.location.href = 'http://v4.ident.me/'"; sleep 2) | telnet localhost 4242 > /dev/null
| change url of web browser thru command line? |
1,465,559,211,000 |
How can I locate a file using locate in CentOS under a specific directory from terminal?
Locate search the whole database!
|
There is no option for that functionality in the output from man locate on CentOS 6.5, at least. But, you could get pseudo-functionality by changing a search term. For example, locate cron might produce too much output, but locate '/var/log/cron' would limit the results to those items in the locate database that match... | How to locate a file in a directory |
1,465,559,211,000 |
It seems when you pass a file to lpr (or pipe to it), it attempts to guess the MIME type. Sometimes, however, it guesses wrong—and then attempts to print something "interesting" at best.
Is there a way to manually override the MIME type?
|
The MIME type is sent in the IPP attribute document-format, which you can specify with the -o option:
lpr -o document-format=text/plain ...
Note that if you try a document format that your CUPS server doesn't support, you'll get an error:
$ lpr -o document-format=image/svg+xml drawing.svg
lpr: Unsupported document-f... | Specify MIME type to CUPS's lpr command |
1,465,559,211,000 |
I want to use multiple instances of command line paramater such as the -d option used by PHP for passing PHP options. I am currently using the getopts command in bash.
With PHP invocation it would look like this:
php -f aPHPscript.php -d memory_limit=120M -d apc=1 -d max_execution_time=120
How would the multiple inst... |
Bash doesn't typically care about the values of the arguments, it's more their ordering, and how they're separated on the command line, by default parsing them based on a space between each argument.
You can see this with a simple for loop construct in a shell script like so:
#!/bin/bash
echo ""
echo "ARGS: $@"
echo... | What is the bash syntax for extracting the values from multiple instances of the same argument? |
1,465,559,211,000 |
At the moment I have a set of files of the form of:
/dir one/a picture.jpg
/dir two/some picture.jpg
What I want to do is copy and change the end to -fanart.jpg to the filename to:
/dir one/a picture.jpg
/a picture-fanart.jpg
/dir two/some picture.jpg
/some picture-fanart.jpg
I've managed to get it w... |
Command substitution (`...` or $(...)) is split on newline, tab and space character (not only newline), and filename generation (globbing) is performed on each word resulting of that splitting. That's the split+glob operator. You could improve things by setting $IFS to newline and disable globbing, but here, best is t... | Copying recursively files with spaces |
1,465,559,211,000 |
I'm looking to install the package for tempfile but am not finding it?
possibly use mktemp but I'm not sure if there is a difference in behaviour
besides a dot notation in the temp name?
$ tempfile # /tmp/file1wJzkz
$ mktemp # /tmp/tmp.IY8k24NayM
|
The name generated by mktemp can be modified to have no dots. For example:
mktemp XXXXX => 8U5yc
mktemp /tmp/XXXXX => /tmp/tsjoG
From man mktemp:
DESCRIPTION
Create a temporary file or directory, safely, and print its name. TEM‐
PLATE must contain at least 3 consecutive 'X's in last component. If
TEMPLAT... | Command(s) to install tempfile on CentOS 6.4 |
1,465,559,211,000 |
Recently I found out a new very useful command. It is:
gnome-open
or
xdg-open
or just
open
on mac.
It opens file or directory in by default specified program.
But, in the event that I need to open a file in an already running redactor (I mean send the file to a running processes somehow) I have no solution. I wo... |
Did you try
eclipse --launcher.openFile <absolute path of file to open>
Eclipse OpenFile Feature.
| Send file to opened editor using command line |
1,465,559,211,000 |
The following command prints a message over ssh :
xmessage Message -display :0 &
How does it work? there is no -display option in xmessage's man page.
|
It's included by (obscure) reference.
SEE ALSO
X(7), echo(1), cat(1)
And buried down a ways in X(7):
OPTIONS
Most X programs attempt to use the same names for command line options
and arguments. All applications written with the X Toolkit Intrinsics
automatically accept the following options:
-display display... | xmessage over ssh |
1,465,559,211,000 |
I regularly find myself having to execute a lengthy command on a file, then process the results with other commands. To process the next file, I usually rerun the same command by hitting the Up key until I find the command I want and arduously replace the old filename with the new filename.
Is there a way to combine c... |
You can't do it with a quick substitution directly, because ^foo^bar is shorthand for:
!!:s/foo/bar/
The !! part (which refers to the last command) isn't part of the quick syntax (that's what makes it quick), but you can use the longer syntax directly and then modify the !! to whatever you want:
!-4:s/foo/bar/
I exp... | How can I apply caret-substitution to my nth-last command? |
1,465,559,211,000 |
If I download a video using youtube-downloader I can watch the part file while downloading (in my case using mpv). Suppose I cannot or don't want to select a format containing both video and audio then the audio in the part file is missing because it is downloaded and merged after the video download is complete.
Is th... |
Option 1: You can select a video download format that contains a mixed/muxed stream of both video and audio.
For example,
yt-dlp -F https://youtu.be/3QnD2c4Xovk
will list formats to choose, and something like
yt-dlp -f 18 https://youtu.be/3QnD2c4Xovk
will choose that format. The partial file contains video and audi... | How to watch video while still downloading including audio? |
1,465,559,211,000 |
I have a file that contains four columns and 5000 rows. I want to make 5000 new files from this file so that each file has one row from the original file. Also, I want to name the new files according to the values in the 4th column.
Example: The following file (XXXX.txt) has four rows
File: XXXX.txt
1 315 4567 G1
1 21... |
You can try by slightly change the awk script:
awk '{print > $4}' XXXX.txt
But be aware if in the source file there is row with same 4th column as other the end file will contain only the last row. You can try something like to avoid it:
awk '{print >> $4}' XXXX.txt
N.B. Do not run it more than once as this will add... | Every row of a file is converted to a new file |
1,465,559,211,000 |
I want to forward the job output from a job run by a third party scheduler. The scheduler allows me to insert the output into a command, e.g. like so:
python script.py --job-output '{joboutput}'
Where {joboutput} becomes the raw job output forwarded by the scheduler.
The issue that I have encountered is that the job o... |
If that command line is preprocessed by the scheduler and it then sends it to a shell for execution (e.g. though sh -c), after doing a simple text replacement of {joboutput} with the actual text, then what you're asking can't really be done. Not on just one line anyway.
It is possible to pass an arbitrary (NUL-termina... | Pass text with unbalanced quotes as argument on command line |
1,465,559,211,000 |
Problem
I am trying to automate a task in my Firefox browser with xdotool.
First, I open a new tab in my browser with:
firefox -new-tab "www.domain.tld"
Then (after the page www.domain.tld has finished loading) I want to perform a task:
if [ <page has fully loaded> ]
then
<commands>
fi
How can I detect whether t... |
You could use a traffic monitoring service like iftop. This tool shows connections based on the hostname (or IP if you wish).
#!/bin/bash
while ( iftop -t -s 5 2>/dev/null | grep www.domain.ltd >/dev/null ) ; do
echo "still loading"
done
Limitations:
needs root to run
assumes proper hostname resolution (will f... | Bash: How can I check if a website has finished loading? |
1,465,559,211,000 |
For example, if I enter the following command:
$ man -k compare
The diff command is missing from the results, however the test command is not. I get the same results using apropos as expected.
$ whereis diff
diff: /usr/bin/diff /usr/share/man/man1/diff.1.gz
$ whereis test
test: /usr/bin/test /usr/share/man/man1/test.... |
This is a bug in the man pages of the GNU diffutils package. As you suspected, the problem is that they show “GNU diff” (etc.) rather than just “diff” as the program name. This causes the man program not to recognize the short description.
python3
>>> import dbm
>>> db = dbm.open('/var/cache/man/index.db')
>>> db['dif... | Why does apropos and man -k omit or miss valid results? |
1,465,559,211,000 |
I forked an open source project to work on but one of the folder names I want to cd into starts with an emoji. How can I enter into it? I know I can use the GUI to look through the folder but I rather prefer using the terminal.
I'm using Ubuntu 18.04.4 LTS
|
Option 1: type the emoji
Simple typing cd '🔥 100 DISTRICT ATTORNEYS 🔥' will suffice. Searching up "how to insert emoji in X" is usually more than enough to get you started on typing emojis in your environment.
If you don't want to set up emoji insertion, you can always copy-paste from the web (searching "fire em... | cd into folder name that starts with an emoji |
1,465,559,211,000 |
I was trying to render the troff file https://github.com/bit-team/backintime/blob/master/common/man/C/backintime-config.1 in terminal.
How can I make the output (using cat or some other utility) look like the way man outputs troff file in the terminal?
Do I need to convert the troff file to some format understood by t... |
Just do
man "${Path-To-Troff-File}"
| Render troff file on terminal like the man outputs on terminal |
1,465,559,211,000 |
I installed Virtualbox on my macOS Catalina 10.15.3. The GUI works perfectly. However, when I try to run a vm from the command line, the shell can't find the VBoxManage command. I need it for docker.
Where does the installer put it?
|
The command line tools for Oracle VirtualBox on macOS are usually kept in /usr/local/bin:
$ type -a VBoxManage
VBoxManage is /usr/local/bin/VBoxManage
These should be available in your interactive shell sessions if you have /usr/local/bin as part of your $PATH.
| Where are the Virtualbox command-line tools on macOS? |
1,465,559,211,000 |
Basically, my hard drive is a mess and I have like 200+ sub-directories in a main directory. I want to essentially move all files in 200+ sub-directories that have the extension .txt etc to a new directory. For example, n00b.txt or n00b.txt.exe
So I try the following command in the main directory consisting of the 200... |
This would move all files with .txt and .txt.exe extensions present anywhere inside the current directory (even in subdirectories) to ~/Desktop/tmpremo.
$ sudo find . -type f \( -iname '*.txt' -o -iname '*.txt.exe' \) -exec mv {} ~/Desktop/tmpremo \;
If you want another extension too, just add -o -iname '*.extension'... | Moving all files with same file extension .txt to a new directory |
1,465,559,211,000 |
Asterisk uses the editline library, and the keybindings can be configured in /etc/editrc.
I have defined some of my own keybindins, some other are left to default values.
How can I print the current keybindings in Asterisk? I am looking for something similar to what bindkey does in zsh.
Also, how can I "unbind" a key,... |
It sounds like it uses NetBSD's editline, a.k.a. libedit.
See the editrc man page
It looks like you can remove bindings using
bind -r ...
Or
bind ... ed-insert
And I guess the easiest thing is to try adding
bind
(without arguments) to the bottom of editrc to list all bindings.
To make Ctrl+D exit, I would try
bind ... | editrc: changing keybindings in /etc/editrc |
1,465,559,211,000 |
I'm trying to get my bash function to call another function that uses bash -c. How do we make functions created earlier in the script persist between different bash sessions?
Current script:
#!/bin/bash
inner_function () {
echo "$1"
}
outer_function () {
bash -c "echo one; inner_function 'two'"
}
oute... |
Export it:
typeset -xf inner_function
Example:
#! /bin/bash
inner_function () { echo "$1"; }
outer_function () { bash -c "echo one; inner_function 'two'"; }
typeset -xf inner_function
outer_function
Other ways to write the exact same thing are export -f inner_function or declare -fx inner_function.
Notice that expor... | Bash: call function from "bash -c" |
1,465,559,211,000 |
I am trying to delete two lines ( 7 and 8) from a .txt file. For this I am using following code:-
#!/bin/sh
Column="7"
sed '"$Column",8d' myfile.txt > result.txt
on running this script, I am getting this error:-
sed: -e expression #1, char 1: unknown command: `"'
Please tell me how to use variable as a part of sed c... |
Variables are not expanded in single quotes. Use this:
sed "${Column},8d" myfile.txt > result.txt
| How to use variable in sed command |
1,465,559,211,000 |
I want to output a video using two videos as input, where these two videos fade (or dissolve) into each other in a smooth and repetitive manner, every second or so. I'm assuming a combination of ffmpeg with melt, mkvmerge, or another similar tool might produce the effect I'm after. Basically, I want to use ffmpeg to c... |
Assuming both videos have the same resolution and sample aspect ratio, you can use the blend filter in ffmpeg.
A couple of examples,
ffmpeg -i videoA -i videoB -filter_complex \
"[0][1]blend=all_expr=if(mod(trunc(T),2),A,B);\
[0]volume=0:enable='mod(trunc(t+1),2)'[a]; [1]volume=0:enable='mod(trunc(t),2... | How to transition smoothly and repeatedly between two videos using command line tools? |
1,465,559,211,000 |
I have tons of PDFs in multiple sub-folders in /home/user/original that I have compressed using ghostscript pdfwrite in /home/user/compressed.
ghostscript has done a great job at compressing about 90% of the files however the rest of them ended up bigger than originals.
I would like to cp /home/user/compressed to /hom... |
The following find command should work for this:
cd /home/user/original
find . -type f -exec bash -c 'file="$1"; rsync --max-size=$(stat -c '%s' "$file") "/home/user/compressed/$file" "/home/user/original/$file"' _ {} \;
The key part of this solution is the --max-size provided by rsync. From the rsync manual:
--max-... | Copy a folder overwriting ONLY smaller files in destination |
1,465,559,211,000 |
For documentation purposes, I mean to redirect to file stdout and stderr from a command I execute.
For instance, I would run (my command is less trivial than the alias ll but it probably doesn't matter):
$ ll > out-err.dat 2>&1
$ cat out-err.dat
drwxr-xr-x 39 us00001 us00001 4096 jul 31 14:57 ./
drwxr-xr-x 3 root ... |
You could use a function like this:
echo_command() { printf '%s\n' "${*}"; "${@}"; }
Example:
$ echo_command echo foo bar baz
echo foo bar baz
foo bar baz
$ echo_command uname
uname
Linux
As Tim Kennedy said, there's also a very useful script command:
$ script session.log
Script started, file is session.log
$ echo... | bash echo the command line executed at the command line itself (not in a script) |
1,465,559,211,000 |
My machine boots into command-line and then I run the following command to open a display with TWM window manager on it:
$ xinit /usr/local/bin/twm
On TWM, this is how I run apps: I left-click anywhere on the black screen and a menu shows up. Then I select xterm and on xterm command-line, I run my app for example:
$ ... |
Define a menu in your .twmrc, like:
Menu "MyMenu"
{
"Opera" f.exec "Opera"
}
Then bind it to your left mouse button instead of the default one:
Button1 = : root : f.menu "MyMenu"
Look at TWM(1) to see how to configure TWM according to you needs. You may also want to see examples of configuration at xwinman.org.
... | How to open apps on TWM window manager without using xterm |
1,465,559,211,000 |
I'm currently running Mac OS Sierra. I don't know exactly how, but somehow I've altered some permissions and think it'd be a good idea to reset them, but I do not know how. Each time I execute sudo, I am met with this warning: sudo: /var/db/sudo/ts is group writable
The command executes fine, but it seems to be a good... |
The following command will remove write permission from group on file /var/db/sudo/ts
sudo chmod g-w /var/db/sudo/ts
| Accidentally set write permission on sudoers? |
1,465,559,211,000 |
I want to find all .xml files in all directories and subdirectories with name 'metadata' in the filesystem. Is there a way to search by pattern similar to
find . -name */metadata/*.xml" (mixing find command and Gradle paralance)
?
|
$ find / -path "*/metadata/*" -name "*.xml"
or, shorter (since * matches past the slashes in pathnames when used with -path),
$ find / -path "*/metadata/*.xml"
Note: I'm using / as you said "in the filesystem", which I interpreted to mean "anywhere".
Alternatively, using locate (will only find files accessible to al... | How to search files by directory and file name combo pattern |
1,465,559,211,000 |
Can you please indicate me how do you find programs in the terminal without knowing the exact name?
As far as I remember, there was a command line tool that helps the user to find out other programs / command line tools associated to some key words. For example I am logged in an unknown system and I want to open a pdf... |
I think about apropos:
From man:
apropos - search the manual page names and descriptions
Example:
$ apropos pdf
dvipdf (1) - Convert TeX DVI file to PDF using ghostscript and dvips
evince-thumbnailer (1) - create png thumbnails from PostScript and PDF documents
fix-qdf (1) - repair PDF files in QD... | Linux command line tool to find specific programs |
1,465,559,211,000 |
In a Linux Foundation course we're told to use cat & at a terminal prompt to return what appears to be the current max (used) PID. I wanted to clarify what the & parameter means but both cat --help and man cat turned up nothing for the ampersand parameter.
Snapshot for clarity:
Can anyone please explain what the am... |
The & means that you send the command to the background (also called forking), and you are given "back" the prompt even though execution of the command continues (if any).
There is a very good discussion about this in this thread.
To know what the max_pid is, you can look in /proc:
cat /proc/sys/kernel/pid_max
32768
... | What does the ampersand in 'cat &' mean in linux? |
1,477,106,372,000 |
Basically, I want to receive input from 2 different files whem I'm calling an executable on terminal
Like:
./a.out < file1.pgm file2.pgm
I want to read both the files input on my code, one after another.
|
For the question, where file1.pgm and file2.pgm are files whose contents you want sent to a.out as input:
cat file1.pgm file2.pgm | ./a.out
If file1.pgm and file2.pgm are executables that produce output for a.out:
(file1.pgm; file2.pgm) | ./a.out
| How to receive input from 2 files on an executable |
1,477,106,372,000 |
I have multiple files, let's say file1, file2 etc. Each file has one word in each line, like:
file1 file2 file3
one four six
two five
three
What I want is to combine them in a new file4 in every possible permutation (without repetition) in pairs. Like
onetwo
onethree
onefour
onefive
...
twothree
...
onefour
...
... |
Use this:
cat FILE1 FILE2 FILE3 | \
perl -lne 'BEGIN{@a}{push @a,$_}END{foreach $x(@a){foreach $y(@a){print $x.$y}}}'
Output:
oneone
onetwo
onethree
onefour
onefive
onesix
oneseven
twoone
twotwo
twothree
twofour
twofive
twosix
twoseven
threeone
threetwo
threethree
threefour
threefive
threesix
threeseven
fourone
f... | All possible permutations of words in different files in pairs |
1,477,106,372,000 |
How can I only scan the computer RAM for viruses using the ClamAV command clamscan?
I already tried, because I found it on ClamWin forum:
clamscan --memory
But it seems, that the Linux version does not have the argument --memory, because I can not find it in the help (clamscan --help or man clamscan).
If I try the co... |
I just tested this in a docker container with an image of debian stretch.
https://packages.debian.org/source/stretch/clamav
The current stable version of Clamav for Linux is 0.99.1.
Source: https://www.clamav.net/
clamscan does not have such an option, I checked the manpage.
It seems that this option exists in the Win... | How to use ClamAV to scan the memory |
1,477,106,372,000 |
I am using Fedora 23. Using the file explorer I "found" this page
It shows where I can access other networks, I can click on them, and log in...
My questions is: Is there an equivalent place I can reach via command line?
That I can log into a network and such....
I am currently under the impression that I would ne... |
Your GUI explorer is using information from the avahi daemon which is listening for services on the local network. You can do the same from the cli with
avahi-browse -rat
| Basic network via command line |
1,477,106,372,000 |
I have a bunch of text files that are named in YYYYMMDD.Txt format (so today would be 20160420.Txt).
Each file is basically a log that contains a timestamp and and a unique ID, each value is separated by tab delimiters.
So for example, 20160420.Txt has the following values:
DATE TIME ID
20160420 0135 1234... |
It is not trivial to find the exact date 6 months ago, especially if the current date would be the 31st of some month. But if you know how to do this with find and -mtime, I would just touch the files depending on the date in their name:
for x in *.Txt; do
dd=${x%.Txt}
touch -t "$dd"0000 "$x"
done
and then use ... | Using grep/sort/find to extract unique values |
1,477,106,372,000 |
I'm trying to execute
ls -d "$PWD"/* > formmlFileList43k.list
But I get the following error:
bash: /bin/ls: Argument list too long
I've read using a pipe won't have such limitation, how can I use pipe which will accomplish the same as:
ls -d "$PWD"/* > formmlFileList43k.list
Any help would be appreciated
|
You have too many items in the directory. That causes the shell to expand * into a command line argument that exceeds ARG_MAX bytes:
$ grep ARG_MAX /usr/include/linux/limits.h
#define ARG_MAX 131072 /* # bytes of args + environ for exec() */
I suggest you to use find as a workaround:
$ find "${PWD}" -mindept... | Argument list too long when running ls -d "$PWD"/* command |
1,477,106,372,000 |
I have a function (not) that displays a notification. Hence, I can use it to show when a command is complete.
sleep 5; not
However, sometimes I forget to add ;not. In OS X's terminal (a few years ago), I could enter a second command, while the current command was running. This second command would execute after the f... |
Well, according to some of your edits you've got CTRL+J bound to a bindkey macro command. That explains your bash issue considering readline's default behavior.
Generally readline reads input in something very like stty raw mode. Input chars are read in as soon as they are typed and the shell's line-editor handles its... | How can I type a command to execute when the current command completes? |
1,477,106,372,000 |
cmd utils such as sqllite don't have full flavoured console support. but I do remember there is something called **wrap which could wrap this console and enhance its capabilities with history, up/down etc...
unfortunately, I forget its name. anyone give a hint?
|
I think you are talking about rlwrap.
rlwrap runs the specified command, intercepting user input in order to provide readline's line editing, persistent history and completion.
rlwrap tries to be completely transparent - you (or your shell) shouldn't notice any difference between command and rlwrap command - ex... | command to enhance console lines with history |
1,477,106,372,000 |
I am writing a series of CLI tools that share the same parent command, similar to programs like git.
program verb OPTIONS
One of the action verbs, install, is designed to git clone as many repositories as URLs are specified.
What is a robust and UNIX-like logical way to determine program success or failure?
Good URL... |
Your program should at least exit(3) EXIT_SUCCESS (i.e. 0) on success and probably EXIT_FAILURE (i.e. 1) on failure. You could copy (or be inspired by) FreeBSD sysexits.h for more failure codes (but I am not sure it is worth the effort).
Don't forget to give some message to stderr (or thru syslog(3)) for any kind of f... | How to determine program success when running a sequence of similar tasks? |
1,477,106,372,000 |
So I am trying to install Eclipse through terminal by watching a video, but when I attempt to run ./configure I get a message saying
bash: ./configure: No such file or directory
I looked around and then realized there was no configure in the eclipse folder unlike the video I was watching. The files that are showi... |
Eclipse doesn't need an installation. Simply run
./eclipse
inside the folder. That's all.
Or create the desktop file. In my example, the Eclipse folder is located in /opt/eclipse
nano ~/.local/share/applications/eclipse.desktop
and add the lines below
[Desktop Entry]
Type=Application
Name=Eclipse
Comment=Eclipse ... | I'm trying to Install Eclipse But When I Try to Run ./configure It Doesn't Work |
1,477,106,372,000 |
I have been trying to list files in directory using ls and passing it different options.
Does it have the ability to list types of files as well ? I want to know which ones are executable , sharedlibs or just ascii files without doing file command on individual files.
|
ls itself won't show this information.
You can pipe the output of the find to file -f -, as follows:
$ find /usr/local/bin | file -f -
/usr/local/bin: directory
/usr/local/bin/apt: Python script, ASCII text executable
/usr/local/bin/mint-md5sum: ASCII text
/usr/l... | How to list files on terminal so that we can see the file types such executable, ascii etc? |
1,477,106,372,000 |
You'll have to bare with my my Linux terminology is pretty bad. When I say virtual terminal I'm talking about when you press ctrl+alt+ a function key (F1-F12). I think they are called virtual terminals.
So I found this snippet that allows you to start an X application in another terminal.
/usr/bin/xinit /opt/someAppFo... |
Use openvt. Note that you'll need to be root, because the terminal devices belong to root unless a user is logged in.
openvt -c 8 myapp
Add the option -s if you want to switch to vt 8 when the openvt command is run.
| Debian Linux: Start/run application/process in another virtual terminal |
1,477,106,372,000 |
I have been using the rename command to get control over my naming conventions across my system. In converting spaces in file names to hyphens, I have inadvertently created consecutive hyphens in some file names. These are proving difficult to remedy using the rename command.
I have tried unsuccessfully with several ... |
To squash multiple hyphens (one hyphen followed by one or more hyphens) into a single one for all files in the current directory use:
rename 's/--+/-/g' -- *
The -- is important if files start with a hyphen, otherwise they would be interpreted as command line arguments. The * expands to the list of files in the curre... | How to change double hyphen to single hyphen of file names? |
1,477,106,372,000 |
I found this bash command that creates a directory tree in your console window. I find it quite useful, but I don't really understand how all of the special characters work. Could someone help break it down for me?
alias tree="ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'"
The... |
alias tree="ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'"
ls -R: list subdirectories recursively
grep ":$": grep only for lines with : at the end of the line
sed -e 's/:$//': remove : at the end of the line
-e 's/[^-][^\/]*\//--/g': replace all path components except of last... | What is the purpose of those special characters in the sed command? [closed] |
1,477,106,372,000 |
My Script is having 2 command-line arguments and then just couple of questions, after these questions the script will run for itself, I'm able to pass the command-line argument by just doing,
-bash-3.2$ nohup ./Script.sh 21 7
nohup: appending output to `nohup.out'
-bash-3.2$
Anyway to add the answers of these to-be-... |
Instead of using nohup, you could have your script ask these questions interactively and then background and disown the remainder of whatever else it has to do.
Example
$ more a.bash
#!/bin/bash
read a
echo "1st arg: $a"
read b
echo "2nd arg: $b"
(
echo "I'm starting"
sleep 10
echo "I'm done"
) &
disown
Sample ru... | How do I Nohup an interactive shell-script? |
1,477,106,372,000 |
I'd like to apply chmods to files and folders in one line,
Basically:
chmod 700 ./* -R # but only apply to folders
chmod 600 ./* -R # but only apply to files
Of course I searched google and read manpages.
So the question is, does the following have any drawbacks, risks or is this safe?
find . -type f -print0 | xargs ... |
There is another possibility which I discovered using ACLs: the uppercase X. Given the following structure (three directories, three files):
drw------- 1/
drw------- 2/
drw------- 3/
-rw------- 4
-rw------- 5
-rw------- 6
It is possible to set the execution but for directories only by using:
chmod u+X *
Which will r... | Apply recursive chmod to files or folders only |
1,477,106,372,000 |
I prefer to set tabs 4 however this may have some side effects, such as for example ls out put may look not properly aligned. How might I configure the terminal / cat to use four spaces for tabs for cat only?
Should I just alias / wrap cat to something that sets tabs 4, runs /bin/cat, then sets it back? My thinking is... |
The curses program tabs will allow you to change what the terminal believes to be the width of a ^I. This would make a simple script
tabs -4
cat "$@"
tabs -8
However, the processing of tab characters on terminals is notoriously wonky and I'm of the impression that you should never mess with them. I suggest using expa... | How to set default tabs only for cat? |
1,477,106,372,000 |
I'm running Debian 6 in a VM on a network that requires Windows authentication to a proxy server before it can run any http/https/ftp connection.
I've tried:
export http_proxy=http://domain\\username:password@proxyIPaddress:8080
and same for ftp_proxy, but I keep getting: "Proxy server requires authentication".
My p... |
You should pass the export http_proxy command as a string. This should do the trick:
export http_proxy='http://domain\username@proxyIPaddress:8080/'
| Proxy server with authentication not working at command line |
1,477,106,372,000 |
Is it possible to start an xfreerdp session into Microsoft windows from a command-line only install of Linux?
The command I use from a full blown Linux install is this:
$ sudo xfreerdp /v:farm.company.com /d:company.com \
/u:oshiro /p:oshiro_password /g:rds.company.com
This command works fine. However, when I ru... |
I assume xfreerdp is a gui programm (an "X client"). So on Linux, you need an "X server" to run it.
That's what you have on the GUI based Linux box.
You can not run it on the command-line-only Linux in itself.
Depending on what you are trying to do, it could make sense
to run it on the command-line-only Linux and show... | Error because $DISPLAY environment variable is not properly set |
1,477,106,372,000 |
I have seen the following line in a bash script for killing a process(in this case started with the command loadgen):
ps xww | grep -i "loadgen" | grep "PATTERNMATCH_FACT.xml" | cut -c1-5 | xargs -i kill {} 2>/dev/null
I would like to understand the reason for piping after the two grep's in the command above.
The wa... |
ps xww gives the following output
...
1 ? Ss 0:00 init [2]
1804 pts/0 Ss 0:00 -bash
...
After the two grep's it pipes the output to cut. This command cuts the character 1-5 out of the output. In the output above it whould be the PID's:
1
1804
This is piped to xargs. Xargs builds commands ... | How does the piping in this command ultimately achieve to kill the process? |
1,477,106,372,000 |
Is it possible? And in reverse alphabetical order?
Essentially, this: How can I move files by type recursively from a directory and its sub-directories to another directory?
Except that each file is not moved to the destination directory unless a separate process has fetched the sole file in that destination directory... |
Do you want something like this?
#!/usr/bin/env bash
## This is the target path, the directory
## you want to copy to.
target="some/path with/spaces";
## Find all files and folders in the current directory, sort
## them reverse alphabetically and iterate through them
find . -maxdepth 1 -type f | sort -r | while IFS= ... | Automatically moving files to a directory, one by one, and only when the target folder is empty |
1,477,106,372,000 |
Possible Duplicate:
What do the numbers in a man page mean?
If I typeman ls, I seeLS(1) in the top left and top right corners of the manpage.
I also see programs on the internet being refered to this way.
ex. man(1), xman(1x), apropos(1), makewhatis(8) and catman(8).
What are these numbers (and in some cases ... |
It's the section number, see
man man
A section, if provided, will direct man to look only in that section
of the manual. The default action is to search in all of the
available sections, following a pre-
defined order and to show only the first page found, even if page exists in several sections.
... | What does the number mean in a man page? [duplicate] |
1,477,106,372,000 |
For some strange reason my filename autocomplete is behaving differently than normal. Given the following file structure ./foobar/file.txt, if I want to delete file.txt, I type rm foob<TAB><TAB> and let the command line autocomplete the filename out to rm foobar/file.txt.
But right now, after hitting the first <TAB> ... |
In my experience, this is usually caused by some misbehaving configuration in one of the files in /etc/bash_completion.d, which get installed and updated as you install various packages. My recommendation would be to move all files out of that directory, start a fresh shell, and see if the behavior returns to normal.... | How to fix Linux filename tab autocomplete that is appending a space instead of trailing slash on directories? |
1,477,106,372,000 |
I am trying to wget a tarball from github.com and, without creating a temporary file, extract a subdirectory from it:
wget -qO- https://github.com/django-nonrel/django-nonrel/tarball/develop | tar xzf - django
It gives me an error saying:
tar: django: Not found in archive
tar: Exiting with failure status due to pre... |
Since the django directory itself is a subdirectory of the resulting gzip content, you'll need to use the --strip-components=1 option of GNU tar. Assuming you're using GNU tar. Then you need to tell tar that you're looking for a subdirectory called django.
wget -qO- https://github.com/django-nonrel/django-nonrel/tar... | Extract directory from wget's stdout |
1,477,106,372,000 |
There is a search page in a form http://example.com/search.php and it sends a search query via POST request. I want to fetch this request via curl command line tool to inspect a POST request.
The HTML form looks like this:
<form action="search.php" method="POST">
<input type="text" name="search" size=20><br>
SZ<... |
As an example, to send a search of "foo" with sz checked and nz unchecked:
curl -d "search_term=search&search=foo&sz=on&nz=off" http://example.com/search.php
| How to format a curl command for a special task? |
1,477,106,372,000 |
When linux commands list their usage, this usually is how they do it (for eg wget):
wget [option]... [URL]...
From what I understand of this pattern of specifying command usage, this is not the usual regex way of specifying patterns and for the wget command says that it is not mandatory to specify any options and by ... |
Typically a syntax where [...] is used to indicate optional args and '|' is used to indicate a logical OR is used in most man pages. It depends who writes the man page as there is no authority that dictates what a man page must read like. More specific to your question however, the man page reads true in this case. Ei... | Unix/Linux command syntax |
1,477,106,372,000 |
If I use
tail -f *filename*
I get a real nice display of whatever is changing in a given file. However, sometimes I want to be able to search this text or otherwise look it over slowly.
Is there any way I can output just the changes to a log file between now and, say, whenever I hit Ctrl-C?
|
This should output everything that goes by into output.txt, if that's what you're asking for:
tail -f filename | tee output.txt
| Output the changes to a log file |
1,477,106,372,000 |
How to use bash command control a Keyboard.
e.g.
what is a command in bash for pressing ctrl+c, ctrl+l, etc..?
|
AutoKey is a desktop automation utility for Linux and X11. It allows the
automation of virtually any task by responding to typed abbreviations and
hotkeys. It offers a full-featured GUI that makes it highly accessible for
novices, as well as Python scripting .... Here is the link to Autokey's homepage.
Note: ... | How to use bash control a keyboard |
1,477,106,372,000 |
I would like a way to refresh a specific window from the terminal command-line.
Probably I will need a command to find the id or the name of the window and a command to refresh it.
It looks like xrefresh cannot do this; how could I do this?
|
With xte tool from xautomation package it is as simple as
xte "key F5"
It will act on the current active window, so you'd have to make sure the proper one is selected previously.
| How to refresh a window by terminal? Or how to simulate `F5`? |
1,477,106,372,000 |
Possible Duplicate:
How to clean up file extensions?
I'd like to rename files with extension .flac.mp3 to extension .mp3.
I used the following command
$ for i in *; do mv $i `echo $i | sed 's/.flac//g'`; done
This writes for every file the following error message.
mv: target `file.mp3' is not a directory
Where a... |
Maybe these files have names containing whitespace.
Simple rule of shell programming: Always use double quotes around variable and command substitutions (unless you know why you need to leave them out). So:
for i in *; do mv "$i" "$(echo "$i" | sed 's/.flac//g')"; done
While you're at it, there are a few things you c... | Multiple renaming files [duplicate] |
1,477,106,372,000 |
I am wondering how to change the time format when I am modifying a time with the touch command in the c shell.
For example I need to use
touch -a -t 051512002015 file.txt
This will change the access time to May 15th 2015, 12:00.
What I want to do though is (notice year is first now)
touch -a -t 201505151200 file.tx... |
This isn't about the shell, touch is an external program.
There were historically two syntaxes for the date argument to touch:
touch -t CCYYMMDDhhmm.SS # CC or CCYY may be omitted; .SS may be omitted
touch MMDDhhmmYY # YY may be omitted
The command appeared in Unix Seventh edition with no date argument.... | Change the time format for the touch command in BSD |
1,477,106,372,000 |
I have problem with wget behavior for 1.10 and later versions.
I am using wget to download a report from my app.
version 1.10.2:
>wget-1.10.2.exe --http-user=trader --http-passwd=trader http://192.168.1.222:8080/myapp/reports/FP201010271100
--11:52:46-- http://192.168.1.222:8080/myapp/reports/FP201010271100
... |
Just add --auth-no-challenge parameter.
If this option is given, Wget will send Basic HTTP authentication information (plaintext username and password) for all requests, just like Wget 1.10.2 and prior did by default.
For details read bug-description
| Difference between wget versions |
1,477,106,372,000 |
Short Version
If you press tab after the following command you get a filer-menu. What is the name of it?
ls *(
Long Version
I just doing my linux-stuff and by accident I pressed tab after ( and a really cool menu popped up I have never seen before.
Suddenly I could select different filters. For example I could look f... |
If you add:
zstyle ':completion:*' format 'Completing %d'
To your ~/.zshrc in addition to the styles you already have, it will tell you what kind of completion it's offering:
$ print -r -- *(<Tab>
Completing glob flag
# -- introduce glob flag
Completing glob qualifier
a -- + access time
A -- group-readable
c -- +... | Zsh - What is this Cool Thing called you get by pressing Tab after "(" |
1,477,106,372,000 |
I have a directory where there are multiple folders, each folder contains multiple .gz files with the same zipped file name "spark.log". How can I unzip all of them at once and rename them like the gz file?
My data looks like this
List of folders
A
B
C
D
In every of them there are files as
A
spark.log.gz
spark.log.1.... |
While gzip does or can store the original name, which you can reveal by running gzip -Nl file.gz:
$ gzip spark.log
$ mv spark.log.gz spark.log.1.gz
$ gzip -l spark.log.1.gz
compressed uncompressed ratio uncompressed_name
170 292 51.4% spark.log.1
$ gzip -lN spark.log.... | gunzip multiple gz files with same compressed file name in multiple folders |
1,477,106,372,000 |
If I have a text-file with a structured list like this:
#linux
##audio
###sequenzer
####qtractor
###drummachine
####hydrogen
##scores
###lilypond
###musescore
##bureau
###kalender
####calcurse
###todo
####tudu
How can I print it tree like to the command-line?
linux/
├── audio
│ ├── drummachine
│ │ └── hydroge... |
Use awk to convert the structure to "normal" pathes.
linux/
linux/audio/
linux/audio/sequenzer/
linux/audio/sequenzer/qtractor/
linux/audio/drummachine/
linux/audio/drummachine/hydrogen/
...
Then you can use tree --fromfile . to read it:
convert_structure.awk:
{
delete path_arr
path = ""
level=match($0,/... | Print structured list to command-line (tree like) |
1,477,106,372,000 |
I'm using ubuntu 20.04 (LTS).
I can't scan networks with iwlist.
$ sudo airmon-ng
PHY Interface Driver Chipset
phy0 wlp1s0 ath10k_pci Qualcomm Atheros QCA9377 802.11ac Wireless Network Adapter (rev 31)
$ sudo ifconfig wlp1s0up
$ sudo airmon-ng start wlp1s0
Found 4 processes that could cause tro... |
This WLAN adapter (Qualcomm Atheros QCA9377) does not support promiscuous mode (aka monitor mode). You have two choices:
You can easily get yourself one of the Alfa cards for less than USD $70.
You can downgrade your Atheros firmware, but not guaranteed.
Reference: https://www.linuxquestions.org/questions/linux-newb... | Ubuntu 20.04 iwlist scanning : [interface] Interface doesn't support scanning : Operation not supported |
1,477,106,372,000 |
I have zsh completion for my custom script. It takes 3 optional arguments --insert, --edit, --rm and it completes files from given path:
#compdef pass
_pass() {
local -a args
args+=(
'--insert[Create a new password entry]'
'--edit[Edit a password entry]'
'--rm[Delete a password entry]'
)
_argum... |
Presuming all of the options you mentioned are mutually exclusive with each other, then the solution is as follows:
#compdef pass
_pass() {
local -a args=(
# (-) makes an option mutually exclusive with all other options.
'(-)--insert[Create a new password entry]'
'(-)--edit[Edit a password entry]... | zsh completion for custom script |
1,588,335,338,000 |
I have been using mutt for a while and got it to work pretty well with 2 gmail accounts.
I have 2 macros set to switch from one to the other.
wanting to move to neomutt, the exact configuration is not working anymore.
I can get to my account individually, but I can't swapp from one to the other.
neomuttrc:
source ~/.... |
the trick was to
set folder = "imaps://[email protected]"
having the same folder for the mailboxes was confusing neomutt.
| Neomutt Multi account |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.