New answers tagged

0

analog-stereo.monitor is a Pulseaudio source for audio recording. It would not be recognised by ALSA when used in file ~/.asoundrc to see information about Pulseaudio sinks and sources, including defaults: pacmd dump default-source for recording can be set with: pacmd set-default-source alsa_output.pci-0000_00_1b.0.analog-stereo.monitor it may also help to ...


3

$_1 means "expand the variable _1". Since this variable was not set, it will expand to nothing. Someone probably made a mistake. It may be that the person thought $_1 would be the same as ${_}1, i.e., the expansion of $_, (which is the last argument to the previous command), concatenated with the number 1. But it is not the same, as can be seen ...


0

Just do man "${Path-To-Troff-File}"


0

For example I have these files in current directory: 1-s2.0-S0038092X0000058X-main.pdf ANNDHW.pdf HPcalculation2 1-s2.0-S0306261999000422-main.pdf ANNlee.pdf HPcalculation3 ANNCanada.pdf HPcalculation HPcalculation4 I want to move all the files starting from HP to folder: ./NewFolder/ I can do: cp ./HP* ./NewFolder/ ./HP* ...


2

man ssh_config shows the syntax for the ProxyJump configuration parameter (which -J is a shortcut to): ProxyJump Specifies one or more jump proxies as either [user@]host[:port] or an ssh URI. In your case it becomes: ssh -J john@123.4.567.89:54321 john@johnaddress or, using the configuration file's option format: ssh -o ProxyJump=john@123.4.567.89:54321 ...


2

zsh -c 'set -xv' tells zsh to run an inline script that contains set -xv. After running set -xv, the script is finished and zsh exits (with the exit code of set). Just like zsh -c uname runs uname and finishes. exec zsh ; set -xv tell the current shell to execute zsh in the current process, so whatever command that lays after will never be executed (and in ...


0

OP here. i put the following lines on my .zshrc alias debugOn='DEBUGCLI=YES exec zsh' alias debugOff='DEBUGCLI=NO exec zsh' if [[ $DEBUGCLI == "YES" ]] then export PS1="%F{013}%2~%f%(?.%F{004}.%F{001}✕%?)%# %f" else . ~/zshfiles/zsh-git-prompt.zsh export PS1="%F{013}%2~%f$(git_super_status)%(?.%F{004}.%F{001}✕%?)%# %f" ...


0

If you are using Oh-my-zsh, take command will do the trick. Take a look at the cheat sheet.


1

Regarding the 2nd part of your question, netstat -plantu will show you only tcp and udp info, that is network connections established and listening ports. netstat -a will show you unix sockets also. That's lots of info, it's better to target what you need on the output. If you run a recent distro, you can use ss instead of netstat. It's a modern alternative, ...


1

Does the output of netstat -a include the output of nestat -l Yes, -a stands for all (listening and non-listening sockets).


0

If you're trying to debug a script, then don't use set -x on the terminal (that's debugging the shell running in the terminal). You can instead start the script with the -x option to the interpreter (e.g., zsh -x <scriptname> [<args>]). If, for example, you have a zsh script named ex.zsh, then you can do: $ cat /tmp/ex.zsh #!/bin/zsh function ()...


1

Perhaps an updated version of @Gilles accepted answer with PyPDF2. Using Python 3 on MacOS. #!/usr/bin/env python # usage pdf_split_double_page.py 2-up-file.pdf output-file.pdf import copy, sys from PyPDF2 import PdfFileReader, PdfFileWriter input = PdfFileReader(sys.argv[1]) output = PdfFileWriter() for p in [input.getPage(i) for i in range(0,input....


0

You can run the app within screen or tmux and connect from an "outside" terminal to that very virtual terminal. ExecStart=/usr/bin/screen -d -m -S gunicorn3 /usr/bin/gunicorn3 --workers 3 --bind unix:flaskapp.sock -m 007 app:app --timeout 300 --config /root/flaskapp/gunicorn.conf.py If the app can be started manually then systemd-run with the ...


0

Did you try this: cd "${path_another}" ${path_to_program}/program "${path_to_program}/file.in" Like I0b0 said in the comment above, the program probably expects "file.in" to be relative to the current directory (here ${path_another}). If it's in the same directory as the program, then you need to specify a path to that file.


1

After unmounting and syncing, the way to safely remove drive sdX without any tools would be (as root): echo 1 > /sys/block/sdX/device/delete If you want to do it through sudo, you'll need to do it this way: echo 1 | sudo tee /sys/block/sdX/device/delete >/dev/null This will tell the kernel that you're going to remove the device. When you do that, the ...


0

If you want to remove the main directory as well. Try below command: rm -rf <directory name> If you want to keep the parent directory intact but remove all its contents: enter code here


0

I do not know whether this works under MacOS; it does under Linux: #! /bin/bash arg1="$(awk 'BEGIN { RS="\0" }; NR==2 { print $0 "x"; exit; }' /proc/$$/cmdline; echo x)" arg1="${arg1%x}" if [[ $arg1 =~ / ]]; then # path contains at least one / dir_rel_path="${arg1%/*}" cd "$dir_rel_path&...


3

tar can create or extract tar's but it can't operate on streams in this way. You'll need something like tar-stream - it even has an example that does what you are asking: https://github.com/mafintosh/tar-stream#modifying-existing-tarballs


1

One can use utility udisks2 (instead of udisks), in the manner mentioned by GAD3R. The binary in this package is udisksctl. Ref: https://askubuntu.com/questions/647473/why-udisks-is-not-in-the-system


4

You do not need to escape the dollar character export PATH=\$PATH:\/usr/local/qc/OPENMPI_3_1_4/bin/ This means you are creating a new PATH with a text $PATH:/usr/local/qc/OPENMPI_3_1_4/bin/. The existing PATH is lost at that moment. What you need is export PATH=$PATH:/usr/local/qc/OPENMPI_3_1_4/bin/ In this case, the old value of PATH (something like /bin:/...


2

It's been six years since the original question, I'm using Cups 2.2.7 And still 'lpstat -a' returns the name of the printer in the first word. So I think it is safe to assume that it will continue as the right way to get a list of installed printers.


1

You can add cd -P -- "${0%/*}" || exit or cd -P -- "$(dirname -- "$0")" || exit to your script to jump into the directory in which the script resides. $0 is a built-in variable holding the path of the script as given to the interpreter (will typically be an absolute path if the script was looked up in $PATH). The ${0%/*} ...


2

For fonts that could be used in Linux with fontconfig (almost all). There are two related questions that usually come from fonts and Unicode: List fonts that could render (contain) a glyph (well, actually, an Unicode code point): fc-list :charset=1f63f | less # all installed fonts that have 1f63f 😿 List Unicode code points that an specific font ...


1

firefox -P profilename %u, without the --no-remote, works for me with several different profiles simultaneously.


4

For a TrueType font, you can use the ttfdump utility which is available from TeXlive. ttfdump -t cmap -i /usr/share/fonts/truetype/freefont/FreeSerif.ttf | perl -CS -ne 'print chr(hex($1)) if /Char (0x[[:xdigit:]]+)/ and hex($1) != 0xffff; END {print "\n"}' Experimentally, this only seems to list code points below U+FFFF. I don't know if this is a ...


0

You probably don't have it in your path. Try: find / -name 'qsiprep-container' to see where it was installed. It's also possible that that is the name of the package but not the executable/program. Make sure you are trying to run the correct target.


0

You want tab-completion to work when entering input to Bash's read? Then read -e is what you're looking for (manual): Options: -e use Readline to obtain the line in an interactive shell e.g. /tmp/foo$ touch abcdef abcghi /tmp/foo$ read -e -p 'enter a filename: ' enter a filename: ab[tab] abcdef abcghi Though you really should make the script ...


0

Insults are simply messages that sudo outputs exactly as all the other messages. You could change this part of the source code: #ifdef INSULT if (def_insults) warning = INSULT; #endif to something like: #ifdef INSULT if (def_insults) say(INSULT); #endif You have to define say() of course and decide how to interface with a Text To Speech ...


3

The netcat or socat tools are great for dealing with application layer streams of data. To forward copies of network packets to other destinations on a Linux machine you want to look at kernel-level iptables. The tee functionality you're looking for could be implemented using the TEE extension: iptables TEE extension documentation The specific iptables ...


6

Network communication is usually bidirectional while tee and shell pipelines only work in a uni-directional way. But, if you have some network services that only receive and never send back data, you can send the same stream of bytes to all of them over TCP with zsh + socat with something like: generate-stream > >(socat -u - tcp:host:8001) > >(...


1

The concept of setting a network mask without an IP is a strange one. The ifconfig utility appears to have been written to assume there will be only one IP address. Interfaces can have many IP addresses and the network mask is always associated with an IP address. Your question doesn't indicate whether or not the interface already has an ip address. But ...


0

First make sure you have the device you want with: ip a show From there you can just set an ip and mask: sudo ip a add 192.168.0.1/255.255.240.0 dev eth0


0

ip addr add 192.168.0.1/20 dev eth0 Still requires you to specify the host IP address, so there's no direct alternative.


4

I don't think there is, but you can always write it yourself as: delete-horizontal-space() { emulate -L zsh set -o extendedglob LBUFFER=${LBUFFER%%[[:blank:]]##} RBUFFER=${RBUFFER##[[:blank:]]##} } zle -N delete-horizontal-space bindkey '\e\\' delete-horizontal-space


0

On RHEL7: echo "$(uname -n):$(ethtool $(ip link|awk '$2 != "idrac:" && $8 == "state" && $9 == "UP" {gsub(":","");print $2}'|head -1) | grep Speed)"


1

I have two suggestions how you can approach what you want (referring to bash only): add it to the history Before typing the first history expansion command line you can disable history expansion (set +H) and "execute" the history expansion command (and then reenable with set -H). It then is part of the shell history and you can easily get back to ...


-1

it will show that output because the terminal think that you type the whole command example : if i type pacman -S vim i will see that error: you cannot perform this operation unless you are root. so i will type sudo !! then before i type the password i will see a line with sudo pacman -S vim


1

I tested the following methods to be working, on Ubuntu 20.04: Method 1: Using the mozlz4 binary from GitHub: Download the linux binary for mozlz4 from https://github.com/jusw85/mozlz4. Then run the following: chmod u+x mozlz4-linux ./mozlz4-linux -x filename.jsonlz4 Method 2: Using the lz4json package from Ubuntu repos: Ubuntu 20.04 repos have a package ...


0

csvq is a command-line tool that uses SQL to query CSV files: $ echo '"this, is the first entry", this is the second, 34.5' | csvq --no-header "SELECT * FROM STDIN" +--------------------------+----------------------+--------+ | c1 | c2 | c3 | +--------------------------+----------------------+-...


0

It is difficult to control this type of updating, mainly because not all programs send the full update data and always in the same position. In this particular case, rclone seems to send the three full data lines every second, so we have to modify them AND also redraw in the same position erasing the old ones, because if the newer are shorter than the older ...


-1

The first step you wanna do is start the tor service. /etc/init.d/tor start or service tor start The next thing you wanna do is start tor on your command line. I am on kali-rolling and tor command just works for me. After doing that, the next thing you should do is torify curl ifconfig.me


0

Just similar to Ankit Shah's answer: (echo "some text" && cat filename) > /tmp/filename && cat /tmp/filename > filename It's not convenient to use such a long command, so I create a simple bash function (in .bashrc or elsewhere possible) as following: echo0 () { (echo ${@:2} && cat $1) > /tmp/$1 cat /tmp/$1 >...


0

nohup watch 'cmd >> output.txt' & This is the simplest and most working solution.


1

You could use a combination of parec and ffmpeg/mpg123/lame, e.g. parec --monitor-stream="$(pacmd list-sink-inputs | awk '$1 == "index:" {print $2}')" | ffmpeg -f s16le -ar 44.1k -ac 2 -i pipe: out.mp3 This will work only if you have a single application outputting audio.


2

This is a SystemD unit file which would restart the command until it is killed by SIGHUP. If the program shall be allowed to exit with a success exit code then use Restart=on-failure instead. [Unit] Description=A program [Service] Type=simple ExecStart=/path/to/my-command -with some parameters Restart=always # Restart=on-failure RestartPreventExitStatus=...


1

Sounds like this might be what you want: awk -v OFS=, 'FNR==1{print FILENAME, $0}' * or if your CSV requires it's fields to be quoted (e.g. if your file names or header lines can contain commas): awk 'FNR==1{printf "\"%s\",\"%s\"\n", FILENAME, $0}' * YMMV if your file name or first line contain double quotes or newlines (in ...


3

Using head and GNU sed: head -n 1 -v * | sed 'N;s/.* \(.*\) .*\n\(.*\)/\1,\2/p;D' Note: the -v is only needed if there's only one file.


2

You can't create XLS files easily from bash, you can create CSV files though and import them into Excel. cd DIRECTORY rm list-of-headers.csv 2>/dev/null for f in *; do head=$(sed -n -e '1s/"/""/g' -e '1p;q' < "$f") file=$(sed 's/"/""/g' <<< "$f") printf '"%s","%s"...


0

Note that the two other answers may provide different results depending on the EXIF Orientation : it seems that convert rotates with regards to the EXIF Orientation, while jpegtran just ignores the EXIF Orientation. This observation led me to figure I actually needed to discard the EXIF Orientation, so I just used exiftool to discard EXIF data without ...


2

Since sha1sum hashes are 40 characters long, you could pipe the output into a head command and pull the first 40 characters from it: echo test | sha1sum | head -c 40 Source: https://stackoverflow.com/a/14992739/4642023


Top 50 recent answers are included