date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,588,335,338,000
On a Debian 9/stretch machine, I can switch from the GUI to the command line by pressing Ctrl+Alt+F4. After doing this... how do you switch back to the GUI? I haven't found any key commands or terminal commands to achieve this goal, so I am stuck in the command line permanently after doing so. The only way I have foun...
Usually you may use alt+F7 for GUI switching
How to switch back to GUI from command line on Debian 9/stretch
1,588,335,338,000
I am trying to zip a directory, but I have a list of specific files that I need to ignore. This list is generated with a script and is quite long so when I pass them to the zip command I get an error saying that the command line is too long. I basically need the functionality asked in this question - Argument list too...
You can (as suggested in the manpage) put your list into a file, rather than using positional parameters for the list: -x files --exclude files Explicitly exclude the specified files, as in: zip -r foo foo -x \*.o which will include the contents of foo in foo.zip while exc...
zip - ignore a large list of specific files without overrunning the command line
1,588,335,338,000
I have a program that outputs data in the format date, time,field1,field2,field3,fieldn 12/20/14,08:01:53,318.622,0.93712,21.6867,1.1089 the file has many columns which all need to stay the same The date format is US, however I need non-US ie date, time,field1,field2,field3,fieldn,.... 20/12/14,08:01:53,318.622,0.937...
sed -E 's,^([0-9]+)/([0-9]+),\2/\1,' Explanation sed -E: use sed with extended regular expressions so we don't have to escape the (), etc. s/foo/bar/: this is the general sed syntax to search for foo and replace it with bar. Here, I've used , instead of /, because there are /s in the expression, and this will simpli...
Changing the date format within a CSV file
1,588,335,338,000
I am trying to replace an extended regular expression using sed on macOS 10.14.3 (18D109). If I do not use the extended regular expression then the inline flag works otherwise it does not update the file, however without the -i flag it prints the correct result to the console. Why does it happen, How could I fix it? $...
When using sed to edit a document in-place (with a sed implementation that supports this), there will not be any output in the console. The file will instead be transformed in accordance with the editing script. $ echo "foo" >foo.txt $ sed -i -E 's/fo{1,}/123123/g' ./foo.txt $ cat foo.txt 123123 On FreeBSD and macOS...
sed inline and extended regex does not work together
1,588,335,338,000
I was reading the man page of find and I found myself confused with the following commands. What is the difference between one and its corresponding one. What is the difference between the following two commands: find -execdir command "{}" \; find -execdir "command {}" \; Cause of confusion: I thought quotation sho...
This is (as you've noticed) rather complicated; I'll try to explain it. It's helpful to think in terms of the parsing/processing sequence the command(s) go through, and watch what happens at each step. In general, the process looks something like this: The shell parses the command line, breaking it into tokens ("word...
Commands Differences Using Quotations (Find)
1,588,335,338,000
The ss command (from the iproute2 set of tools which comes as a newer alternative to netstat) has in its --help the following options -0, --packet display PACKET sockets -t, --tcp display only TCP sockets -S, --sctp display only SCTP sockets -u, --udp display only UDP so...
A raw socket is a network socket (AF_INET or AF_INET6 usually). It can be used to create raw IP packages which can be used for troubleshooting or to implement your own TCP implementation without using SOCK_STREAM: Raw sockets allow new IPv4 protocols to be implemented in user space. A raw socket receives or sends th...
ss command: difference between raw and unix sockets
1,588,335,338,000
How to configure bash/zsh to show a small key icon when the prompt asks for a password like Mac terminal? Is this even possible?
Your shell cannot help you because it isn't even active at this point. It's just sitting in the background waiting for the command to terminate. The shell runs the sudo command, after that sudo interacts with the terminal. (Suggested background reading: What is the exact difference between a 'terminal', a 'shell', a '...
Show a small key icon when the prompt asks for a password
1,588,335,338,000
When you do something like this: echo 'Hello World' Or like this: x=12345 echo "x is: $x" In the first example, does the echo command receive 'Hello World', or does it receive Hello World? And in the second example, does the echo command receive "x is: $x", or does it receive x is: 12345? So basically my question is...
Quotes, variable expansion, wildcards, and everything else mentioned in the bash manual section on expansion is handled by bash. For example, when you run the bash command echo "x is: $x", bash parses this to find out that it needs to run the command echo with one argument which is x is: 12345. Given echo "x is" "$x...
Are the single quotes and the double quotes handled by "bash" or by "echo"?
1,588,335,338,000
When uploading a file as a form field in curl (for example, curl -F 'file=@path/to/file' https://example.org/upload), curl sometimes sets the MIME type differently than what is returned by other utilities determining MIME type. For example, on .bmp bitmap files, file -i path/to/file.bmp says it's image/x-ms-bmp, but c...
From some source code spelunking for Content-Type curl appears to do some file extension matching otherwise defaulting to HTTPPOST_CONTENTTYPE_DEFAULT which is application/octet-stream, in the oddly named ContentTypeForFilename function: https://github.com/curl/curl/blob/ee56fdb6910f6bf215eecede9e2e9bfc83cb5f29/lib/fo...
How does `curl` on the command line determine the MIME type of a file being uploaded?
1,588,335,338,000
When typing my password in a console I sometimes notice I did not write it properly. In these cases, I normally use Ctrl + u to reset and start from scratch. However, there are cases in which I know I typed everything fine but the first letter. Is there a way to go to the beginning of the word and replace it? The unde...
Control-a is readline keybinding that bash uses by default. Other programs such as sudo or su apparently don't use it (might look into the their source code to learn how they handle input). But you can always simulate readline with a program called rlwrap. For example: $ rlwrap sudo echo hi Password: ******** Now...
How to go to the beginning of the password when typing it?
1,588,335,338,000
I would like to get the sha1 checksums of all files inside a simple tar archive as a list. This should be done on a busybox machine where only a minimal tar binary is avalable, see http://linux.die.net/man/1/busybox for the available commands. Without using the disk space to unpack the big tar file. Something with pip...
Here are some major problems with this solution : tar tf test.tar|while read file;do echo $file $(tar xOf test.tar $file|sha1sum);done 1-The tar of busybox cannot show differently filenames with newlines. 2-The "read" from shells does not handle backslash properly. ("\" characters are eaten or "\n" is replaced by a n...
How to create sha1 checksums of files inside a tar archive on busybox without using much disk space
1,588,335,338,000
The Angular 2 style conventions says that lazy loaded folders should start with a plus sign (+). This works fine when doing cd +directory/, but becomes problematic when using commands on files inside those directories from outside. vim +folder/file.ts does not work. Doing git rm --cached **/*.js* in the base director...
A lot of commands (head/tail, sort, sh, vim...) treat arguments that start with + specially, so it's not a good idea to use that as the first character of a file name. Same goes for - which is even more commonly used as option leader character. Like for -, to avoid that + being treated specially, you could use a ./ pr...
How to use commands on files inside directories starting with a special character?
1,588,335,338,000
I have a command that builds things and then provides an interactive shell through prompt (eg type R to restart, Q to quit, ...). I would like to use that command but stop it once it reaches the prompt part. Is there a way to either pass the "Q" argument when calling my command, or killing it once it reaches the promp...
Given that your script is reading input "normally" via read, you can provide it input ahead of time with another program like echo or printf via a pipe: echo Q | your-program-here A more complex example could be: (echo 1; echo thing2; echo yes; echo Q) | your-program-here And even more complex scripting of automatic...
Start command and provide prompt parameter
1,588,335,338,000
Why xdotool is not clicking when restoring position? xdotool mousemove --sync 4000 1000 click 1 mousemove restore If I don't restore the position, it works, example: xdotool mousemove --sync 4000 1000 click 1 EDIT1: What I've tried eval "$(xdotool getmouselocation --shell)" xdotool mousemove --sy...
Your application may need you to wait for it to get focus before it accepts button events. If possible, use windowactivate to get the window focused first, or if not, do a short sleep .2 say, after the mousemove and before the click.
Why xdotool is not clicking when restoring position?
1,588,335,338,000
You can use xargs to discover limits about the commandline you're using: $ xargs --show-limits Your environment variables take up 1901 bytes POSIX upper limit on argument length (this system): 2093203 POSIX smallest allowable upper limit on argument length (all systems): 4096 Maximum length of command we could actuall...
It's what it says on the tin: “Maximum length of command we could actually use” is the maximum possible command line length, given the limit on the platform where xargs is running and the space taken up by the environment. This value only depends on the platform configuration and the environment. “Size of command buff...
What is the meaning of xargs show limits output
1,588,335,338,000
If you want to execute one command and then another one after the first one finish, you can execute command1 & which prints the PID of the process executing command1. You can then think of what you want to do after command1 has finished and execute: wait [PID printed by the previous command] && command2 However, thi...
Often, having given a long-running command, when you want to prepare the next command to run afterwards, you use shell job control to achieve it. Eg, you have given command1, not with an &, and then you want to give command2, so you suspend the current running command by typing control-z. You now have the shell prompt...
Wait for program in a clean way (e.g. in a different terminal window)
1,588,335,338,000
The Unix package datamash supports the application of several summarizing operations to groups of input lines. For example1, here datamash is used to compute the sums of column 2 for each value in column 1: $ cat example.csv 1,10 1,5 2,9 2,11 $ datamash -t, -g 1 sum 2 < example.csv 1,15 2,20 Although datamash suppor...
Doesn't sound to me like a job for a shell. I'd do it in perl/python/ruby... though here awk may be enough: $ cat sum paste -sd + - | bc $ sort -t , -k 1,1 input | awk -F, -v cmd=./sum ' function out() {printf "%s,", l;close(cmd)} NR>1 && $1 != l {out()} {print $2 | cmd; l=$1} END {if (NR) out()}' 1,15 2,2...
On applying commands to groups of lines from stdin
1,588,335,338,000
I'd like to know if I can track commands entered by user in a bash shell, in real time. What I'm trying to do is something similar to thefuck, but I need to prompt the user as and when he enters new commands into the shell. Is there any way I could write a hook to bash that kind of lets me wrap my code around it ? Al...
Put export PROMPT_COMMAND='history -a' to /etc/profile or other profile file. This causes the history -a command to execute before every command prompt display. history -a flushes history to .bash_history immediately.
Is it possible to track bash commands in real time?
1,588,335,338,000
Our hosting providers have installed 3 versions of PHP onto our linux box and when I SSH into it the command php points to use/bin/php which is version 5.2, the command php-5.4 points to usr/bin/php-5.4 which is version 5.4 of course. This isn't a problem when I just need to run a single script that needs a newer ver...
You can attack this in a variety of ways. Method #1 - alias You can make an alias, php=php-5.4, and then attempt to run your script. Assuming that it relies on the current shells ability to locate how to run things, then it should pickup the alias for php instead of the php that's located under /usr/bin. Method #2 - $...
PHP CLI and Bash - change behaviour of PHP keyword
1,588,335,338,000
When I install Linux Mint (Mate, Qiana) I like to make Mate panel more wide (or may be "higher"). Default it is near 20 pixels. I make it, for example, 45 pixels. I can easy set it by right button click mouse on the panel. Now I want to make file with all my preferences that I use to install in Linux. There will be c...
I don't have a MATE environment to test on but in general, this type of thing can be set using gsettings. Try this: gsettings set org.mate.panel.toplevel:/org/mate/panel/toplevels/bottom/ size 45 That should set the value you want. For more details, see http://wiki.mate-desktop.org/docs:gsettings.
How to set size of mate-panel via command line (not via dconf)?
1,588,335,338,000
I use the following command to parse a log file for a particular string. Then I search backwards in the log to find the data I really want. The problem as in the example below, I am only going back 50 lines. It is unknown if the text I am looking for will be 5 lines back, 200 lines back or more. Is there a way to s...
tac LCSoap_8.log | sed -n ' /Server returned HTTP response code: 500 for URL:/,/qualified-src-dn=.*src-dn/!d s/.*qualified-src-dn=\(.*\)src-dn.*/\1/p' or to reuse your grep: tac LCSoap_8.log | sed ' /Server returned HTTP response code: 500 for URL:/,/qualified-src-dn=.*src-dn/!d' | grep -Po '(?<=qualified-src...
How parse a log file for a string, and when found search backwards for another string
1,588,335,338,000
Let's have a look at the followings: radu@Radu:~$ mkdir test radu@Radu:~$ cd test radu@Radu:~/test$ rmdir ~/test radu@Radu:~/test$ man ls man: can't change directory to '': No such file or directory Normally, I would say that the last line from the previous output from my terminal is an error. But how can I understand...
The difference between man and other commands like ls is that latter ones (those not complaining about non-existent directory) don't try to explicitly change there but already stay there. Man also does, but it additionally tries to explicitly change there, too. UNIX directories (as files) aren't deleted immediately w...
Strange error (?) when I run `man` command from a folder that no longer exists
1,588,335,338,000
I'm having difficulty converting some zenity based script to use whiptail instead. The working script looks something like this: #!/bin/bash xfreerdp /v:farm.company.com \ /d:company.com \ /u:$(zenity \ --entry \ --title="Username" \ --text="Enter your Username") I am trying to convert this to use whiptail instead, b...
The reason the that you do not see the input box is because whiptail writes the display to stdout, which you are capturing. The result of the input is written to stderr, which you are not capturing. To make this work, you need the command substitution to capture stderr, but not stdout. You can do this with redirection...
Change script to use whiptail instead of zenity
1,588,335,338,000
How can I put the output of head -15 textfile.txt to a variable $X to use it in an if command like this: if $X = 'disabled' then ?
x="$(head -15 testfile.txt)" if [ "$x" = disabled ] then echo "We are disabled" fi Generally, any time that you want to capture the output from a command into a shell variable, use the form: variable="$(command args ...)". The variable= part is assignment. The $(...) part is command substitution. Also note tha...
setting output of a command to a variable [duplicate]
1,588,335,338,000
I'm parsing data in the following format: prop1=value1:prop2=value2:prop3=value3+prop1=value4:prop2=value5 parts of the string are delimited by + properties can appear in any order the desired output is the value of prop2 from the string part where prop1 has a particular value (input) Can I achieve this through sta...
Based on devnull's answer I put together this: echo $LINE | tr '+' '\n' | grep "prop1=$VALUE" | tr ':' '\n' | grep "prop2=" | cut -d= -f2 I'm still open to any better answers.
Printing specific section of a line when a trigger value is present
1,588,335,338,000
I want to receive live TCP stream, and make it readable by another processes at the same time, without saving it. For example, 111.222.233.244:1234 streams actual time. Server supports only one connection. TTY1: $ nc 111.222.233.244 1234 | (do something here) /tmp/tcpstream & $ sleep 5 # stream is received even if the...
Perhaps the tcpclone tool can help you. It listens for incoming connections on a certain port, and any data read from standard input is forwarded to those connections. Your example should then become something like this: $ nc 111.222.233.244 1234 | ./tcpclone 5555 & $ nc 127.0.0.1 5555
How do I share stdout between multiple processes?
1,588,335,338,000
I'd like to get a custom output from the tree command, but unlike this question, I don't have a fixed format. I'd like to be able to give the command the format in an argument (for instance perhaps -f=y, -f=yaml,-f=xml,-f=~/myformat.fmt). Obviously this is a huge undertaking, but I feel it would be a good way to get t...
On Debian, Ubuntu, Mint and other distributions using Dpkg and APT to manipulate packages: dpkg -S /path/to/file looks for the installed package containing the specified file, e.g. dpkg -S /usr/bin/tree dpkg -S $(which tree) apt-file search /path/to/file looks for the package in the distribution containing the speci...
Edit tree to output in custom format?
1,588,335,338,000
I have a file with some data in this form: Prefix text: First Name, Second Name, Third-- The prefix differs by line. The number of names varies from one to several. The suffix (-- in the example) is optional and non-alphabetic. I need to expand the comma-separated list of names into multiple lines (easy: s/,/\n/g), b...
perl -lne 'if(/^(.*?: )(.*?)(\W*)$/){print"$1$_$3"for split/, /,$2}'
Expanding comma-separated list into separate lines
1,588,335,338,000
I got a VPS with a user dedicated to store my files. As i am aware of the current situation with the NSA and many other governments, and my VPS is hosted on a doubtful country i would like to ensure my privacy (not that i have any top-secret file, or anything similar). I am thinking of making the home folder of my use...
So, since you seem Ok with the idea, for any searchers: Ecryptfs and its associated PAM facilities do more or less what you want. The filesystem stores an encrypted key which the PAM module locks and unlocks as appropriate. This key is used to read and write files on a fuse filesystem that is mounted on top of the rea...
Mount home partition on user login
1,588,335,338,000
I'm a Vim user, so I'm learning Emacs commands for use in the Bash CLI. I know that on my systems I can use Vim-keybindings in Bash but I'd like to learn how to use it effectively in its default configuration. First order of business: Moving around. Let us assume that I've got the following on the CLI: $ mv some_long_...
Alt-4 Alt-B (like in ksh and zsh, and tcsh where they all most probably copied it from). That assumes the terminal sends the sequence of characters ESC, 4, ESC, b upon those key presses. The same combination works in Emacs too, by the way. I'm not aware that there's any way to repeat a motion (other than the search o...
Navigating the CLI: Go back N words
1,588,335,338,000
I am trying to figure out how to create a zip file for each subfolder containing only files that match my criteria. For instance I have: Folder1 Folder2 Folder3 Each folder contains the same set of files but the filenames in each are slightly different, but the extensions are always the same. I would like to zip the ...
If all the weirdness in your directory names is that they have spaces, this should do: shopt -s nullglob for dir in */;do dir="${dir%/}" zip "$dir".zip "$dir"/*.{shp,shx,qpj,prj,dbf} done
Create Zip for each subfolder but containing only matched files
1,588,335,338,000
I have a run.sh in a directory in ubuntu linux 12.04 LTS. I've been changing the Path variable so that it can "see" binaries elsewhere in the directory structure. But I am still getting a command not found even if I specify the full path. I have only basic working knowledge of linux. What is going on? Why can't it see...
You should make it executable with chmod a+x run.sh and then try again. This will make the file executable.
why can't linux see my run.sh command?
1,375,797,819,000
When I execute a command in Ubuntu, which results in a listing, I get results without the field names. Example is ls -l or ps l. I am not very experienced and always need to go digging through man pages and online documentation. And the names are quite crypcit already. Is there a way to turn on field name listing glo...
As @StephaneChazelas stated this isn't possible. You're only other options are to modify the source (don't do this) and/or develop some wrapper scripts and aliases for yourself to assist. There is this technique for preserving the columns of ps in output that you're going to pipe to sort. sort but keep header line in...
How to set what field names are displayed in listings?
1,375,797,819,000
One can look up Unicode Characters with Regular Expressions. On Jan Goyvaerts website I found a RegExp whose meaning I don't understand : \p{Zs} or \p{Space_Separator}: a whitespace character that is invisible, but does take up space So I wonder if I got this right: a Whitespace Character is the 'empty' space be...
Some classic ASCII invisible whitespace characters are: Tab : \t New line: \n Carriage return : \r Form feed : \f Vertical tab: \v All of these are treated as characters by the computer and displayed as whitespace to a human. Other invisible characters include Audible bell : \a Backspace : \b As well as the lon...
what is "an invisible whitespace character that takes up space"
1,375,797,819,000
I suspect there’s some terminology for this question that I’m not aware of. It’s hard to check if a question has already been answered if one doesn’t know the proper vocabulary. So, sorry if this is a repeat question… I’ve slowly become comfy with bash over the past 2 years or so. (I use the Homebrew package manag...
I always use bash within tmux (was screen till recently). tmux/screen allows you to set these. Read up the tmux/screen manual on how to setup these. I find it tyring to use bash without tmux/screen.
How to put “glue” CWD (etc.) to part of the screen instead of putting into PS1?
1,375,797,819,000
I'm using Arch Linux and Urxvt as terminal emulator. When I scroll up/down, text lines gets rendered so slow I can count by top to bottom (heh, 1st line get rendered... ohh, 2nd one! ...). It takes like a full second to get new content rendered in terminal. The worst is reading man pages, looking at Git's log etc.. I ...
The problem was that I got shortcut for opening urxvt which called the terminal with addition arguments (“-lsp 2 -bc“). Removing arguments solved the problem.
Urxvt draws lines slowly
1,375,797,819,000
Possible Duplicate: what does the @ mean in ls -l? What does the @ sign mean in the following "ls" output? -rw-r--r--@ 1 root wheel 489 Jan 4 13:14 boot.plist
the @ indicates an extended permissions set. The -e option will display the extended attributes.
What does @ sign mean in 'ls' output on Mac OSX Lion terminal? [duplicate]
1,375,797,819,000
How could I change the lock option for the xscreensaver from the command line? Been looking around and couldn't find anything about it. xscreensaver-command -lock will lock it right away, which is not what I'm looking for. I'm using Fedora 14.
I haven't been able to find an actual command to change the lock feature, but in the configuration file .xscreensaver, located in the home folder, I've found the value of lock: lock: False In order to modify its value, I can change the value in the config file by using the command: sed -i 's/\(lock:\t\t\).*/\1False/' ...
Change xscreensaver lock option command
1,375,797,819,000
I can't seem to find any documentation on this. This forum post shows someone trying to change the voice used by festival, outside of the festival interpreter, using a command-line flag. festival --\(voice_kal_diphone\) --tts "Langalist.txt" It doesn't work. As a solution, the OP's program's configuration file ends u...
If you just want to select a voice before doing TTS, you can use text2wave echo 'hello world' | text2wave -eval '(voice_kal_diphone)' > hello.wav text2wave is a Festival script itself, so you could fairly easily customize it. You can do similar with the Festival command line: festival '(voice_ked_diphone)' '(SayText ...
How to make festival evaulate its own scheme expressions from the command line, so as to change voices as needed?
1,375,797,819,000
I'm using the command sudo nethogs to watch network traffic. I have a problem in that the name of the program is too long (it doesn't fit in the PROGRAM column). I haven't found any nethogs configuration switch dealing with this issue. Do you know how to see the whole name of the process?
I don't think nethogs offers a feature like that, but you can use the process id it shows in the first column to look up the information. cat /proc/$PID/cmdline or ps -p $PID -o 'args=' should both work on Linux, for example.
Whole program name not visible in nethogs
1,375,797,819,000
When I ssh as root to a remote machine, the command output looks like this: root@Machine:/current/path#: However, if it's a non-root user, all I see is: $ How can I get the same behavior as for the root user? Why is it different?
The "command output" that you referred to is called "the prompt". At the end of the prompt usually there is a character (in bash usually # or $) to indicate the end of the prompt and the start of user input. It is different so that you know if you are the root user or not. Generally when you see a # at the end of you ...
ssh behavior for root and non-root user
1,375,797,819,000
How do I reimage openwrt in such a way that all my settings will be lost. I've been having some issues, and I want to ensure that it's not a lingering setting, I want this to be a fresh install.
OpenWRT versions from Kamikaze onwards (which is basically Kamikaze and Backfire, but not White Russian) do not use NVRAM to store settings or configuration. It is all stored in the filesystem, either in the base squashfs image or the overlayed jffs image. This means you should be able to re-flash the image and get ba...
How do I reimage OpenWRT?
1,375,797,819,000
As the title says, I'm looking for a monolingual french dictionary that I can query on the commandline, ideally offline. For example to have a low latency way to check the gender of nouns. I looked at the freedict language packs that are available for dictd via apt-get (on Ubuntu), but they all seem to be bilingual? D...
On most repositories, there's sdcv, the console version of StarDict program.Freely available dictionaries in StarDict format for offline use. Use html2text to correct the dictionary's HTML output for reading at the console. Set up an alias for easy lookup. sdcvfr() { sdcv --data-dir="/path/to/french_file" --non-inte...
Monolingual french offline commandline dictionary?
1,375,797,819,000
In my machine I, have multiple xdg-desktop-portal $ ls -la /usr/share/xdg-desktop-portal/portals .rw-r--r-- 100 root 23 Mar 14:48 gnome-keyring.portal .rw-r--r-- 99 root 20 Mar 02:25 gnome-shell.portal .rw-r--r-- 548 root 18 Oct 2022 gnome.portal .rw-r--r-- 495 root 29 Nov 2022 gtk.portal What is the command to sw...
The xdg-desktop-portal is an interface that allows applications to communicate with the desktop environment, it is not something that can be switched between different implementations using an environment variable. An XDG Desktop Portal (later called XDP) is a program that lets other applications communicate swiftly ...
How to switch to a different xdg-desktop-portal?
1,375,797,819,000
Assume I have many *.txt files on directory texts with the below contents. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam tincidunt mauris eu risus. Vestibulum auctor dapibus neque. And I want to replace them with the following contents recursively. Vestibulum commodo felis quis tortor. Ut aliquam ...
I'd use perl instead of sed (or awk): find texts/ -name '*.txt' \ -exec perl -0777 -p -i.bak -e ' BEGIN { $search = q{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam tincidunt mauris eu risus. Vestibulum auctor dapibus neque}; $replace = q{Vestibulum commodo felis quis tortor. Ut a...
How to Replace Multiple Lines using Files on Termux
1,375,797,819,000
Using tools like curl or wget it's easy to "get" the response of an HTTP GET request, but both tools aren't installed by default on OpenBSD, and writing a portable shell script, it cannot be assumed that they are installed on ones another machine. I want a "secure" way to get the server response (for example for wikip...
You don't specify if you want the headers, the response code or specifics about the TLS protocol. As already answered, you can use ftp. The -d switch on ftp gives you quite some information on the HTTP(S) level: $ ftp -d -o /dev/null https://en.wikipedia.org host en.wikipedia.org, port https, path , save as /dev/null,...
How to get HTTPS response from a Website using OpenBSD base tools?
1,375,797,819,000
I made a silly mistake by using the wrong output filename when resuming a ddrescue. This is what happened: ddrescue -b 2048 -d -v /dev/sr1 IDTa.img IDTa.ddrescue.log Then the computer crashed and I mistakenly resumed with: ddrescue -b 2048 -d -v /dev/sr1 IDTa.iso IDTa.ddrescue.log I gather that both image files wil...
I think this can be done with ddrescue itself. You need --generate-mode. When ddrescue is invoked with the option --generate-mode it operates in "generate mode", which is different from the default "rescue mode". That is, in "generate mode" ddrescue does not rescue anything. It only tries to generate a mapfile for la...
Merge two binary image files by boolean OR (ddrescue output filename mistake)
1,375,797,819,000
I am a long time user of FileZilla. Now for want of efficiency, I am switching to command line sftp from Linux desktop to a Linux server. The sftp put command works perfectly fine for uploads. However, unlike FileZilla, there is no prompt of confirmation for overwriting an existing file on the server. I certainly fea...
No, the put command in sftp is not able to provide an interactive prompt to you for confirming the overwriting of an existing file. It assumes that you know what you are doing. If you want to make sure that you upload files without overwriting existing files, use the sftp command mkdir to make a directory on the remot...
sftp put: how to prevent accidental overwriting of files
1,375,797,819,000
I would like to export all certificates in a certificate chain to separate .crt files with a single command. How can I do that? To provide some background information: I would like to use the openssl bash utility: (openssl s_client -showcerts -connect <host>:<port> & sleep 4) the above command may print more than one...
It turns out awk can be used to solve the problem: (openssl s_client -showcerts -connect <host>:<port> & sleep 4) | awk '/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/{if(/-----BEGIN CERTIFICATE-----/){a++}; out="/tmp/<host>"a".crt"; print > out}' Replace <host> and <port> with actual values. The sleep comm...
How to export all certificates in a certificate chain to separate .crt files with a single command
1,375,797,819,000
Is there an elegant, high-performance one-liner way to remove multiple complete strings from an input? I process large text files, e.g., 1 million lines in inputfile, and 100k matching strings in hitfile. I have a perl script which loads the hitfile into a hash, and then checks all 'words' in each line of an inputfi...
How big is your hitfile exactly? Could you show some actual examples of what you're trying to do? Since you haven't provided more details on your input data, this is just one idea to try out and benchmark against your real data. Perl regexes are capable of becoming pretty big, and a single regex would allow you to mod...
Remove multiple strings from file on command line, high performance [closed]
1,375,797,819,000
I have a computer with Ubuntu + a graphical desktop installed where I often run OpenGL applications just to capture the screen and make videos. I only care about the generated video, but to create the OpenGL context, I need to open a window, so I have a program that I can run from the terminal that opens the window, ...
You need to set the DISPLAY variable to the one where the GUI session (X, Wayland or Mir) is running on the host. You can use the who command to see which display your GUI session is running on (assuming you're already logged in on the remote host's GUI in another session). Another solution would be to use VNC or SPIC...
Run X application remotely, run GUI on remote host [closed]
1,375,797,819,000
I want to write a PROMPT_COMMAND that's responsive to whatever was provided to the command prompt immediately previous. For example, to switch between an expansive, informative prompt or simple, compact prompt, like so: mikemol@serenity ~ $ echo hi hi $ echo ho ho $ echo hum hum $ mikemol@serenity ~ $ Values only app...
I ultimately didn't need PROMPT_COMMAND at all. Thanks to Christopher for pointing me in the right direction. Instead, consider this file, ps1.prompt: ${__cmdnbary[\#]+$( echo '\u@\h: \w' # Your fancy prompt goes here, with all the usual special characters available. ) }${__cmdnbary[\#]=}\$ I can then feed this i...
How to detect if a command was provided to the shell prompt
1,375,797,819,000
How can I run a Scheme expression from the command-line using neither a script saved in a file, nor starting the interactive shell? The equivalent in Python would be: python -c "print 1+1". scheme (+ 1 1) just starts the interactive shell and shows the result inside it.
I installed guile and was able to have it execute code four ways: 1 $ guile <<< "(+ 1 1)" GNU Guile 2.0.9 Copyright (C) 1995-2013 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain cond...
Run Scheme one-liner from the command-line
1,375,797,819,000
Having installed the AWS CLI with pip install --user awscli what's the syntaxt to invoke awscli? It's listed here: thufir@doge:~$ thufir@doge:~$ pip list DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf u...
solution: thufir@doge:~$ thufir@doge:~$ tail .bashrc -n 1 export PATH="/home/thufir/.local/bin/:$PATH" thufir@doge:~$ thufir@doge:~$ aws configure AWS Access Key ID [None]: Would've been much easier to just install with sudo.
how to invoke awscli from pip install?
1,375,797,819,000
So I have kinda just resigned to using nano for this, but I though I would put it out on Unix.Linux to A) Challenge somebody and B) learn how/if It can be done. I want to prepend a link to an rsa file (command="/sbin/shutdown -h now"). Most of the things I found when google "cat prepend to file" make it so it would en...
This is a simple sed command: sed 's!^!command="/sbin/shutdown -h now" !' If the public key is in a file then you can use the -i flag to edit the file in place: $ cat key.pub ssh-rsa MySRasKeytsadnasdnasd $ sed -i 's!^!command="/sbin/shutdown -h now" !' key.pub $ cat key.pub command="/sbin/shutdown -h now" ssh-rsa ...
Cat prepend to first line, NOT new line
1,375,797,819,000
I need to copy around 40.0000 files into date structured folders. example file: /var/public/voicelogging/quality_monitoring/20151209/bbbbbb_I_20151209-185841_xxxxxx_12434_89343.WAV Is one of the many files I need to copy to /home/username/logging/ The file name has 2 variables in it that I need to use: bbbbbb_I_20151...
One way with find and install: find /var/public/voicelogging/quality_monitoring -name \*.WAV -exec sh -c ' bn=${0##*/}; x=${bn%%-*}; dt=${x##*_}; y=${bn%_*}; id=${y##*_} install -D "$0" "/home/username/logging/${id}/${dt}/${bn}"' {} \; this uses parameter expansion to extract the date: ${dt} and the user id: ${id} f...
copy huge number of files into date structured directory order
1,375,797,819,000
How do I get multi-word autocompletion with rlwrap for tclsh? Example: I type file <space> then pressing <tab> <tab> I only want to see the sub-commands to file, such as exists isdirectory or isfile. I tried adding file\ isfile (i.e. escaping the space) to the completion file, but this did not help. It just caused isf...
With the help from the excellent answer from thrig I cooked the following tclsh multi-word completion filter for tclsh. The script below should be stored in tclsh_filter and executed with rlwrap -z tclsh_filter tclsh. Remember to chmod +x tclsh_filter. #!/usr/bin/env perl use strict; use warnings; use lib $ENV{RLWRAP...
rlwrap: tclsh multi-word autocompletion
1,375,797,819,000
I have one dvb-t and one dvb-s card in my system which are in /dev/dvb/adapter0 and /dev/dvb/adapter1 Is there a way to find out which card is currently working? and which one isn't?
You can use lsof to see which processes are using a file. In your case: $ lsof /dev/dvb/adapter0 $ lsof /dev/dvb/adapter1 Each call will give you a list of the processes having requested a handler (file descriptor) to your device. If nothing is printed, you can conclude that your device is not currently in use. Here'...
Which device is working
1,375,797,819,000
Am trying to enable proxy arp for some of the interfaces, with the normal interface name eth0, eth1, etc [[email protected]]# sysctl net.ipv4.conf.eth0.proxy_arp 0 But for interface names such as "eth1.11, eth2.1" its giving the below error. Tried different format "", '' etc. but no help. [[email protected]]# sysctl...
Finally found out the way to doing this, here it goes. It seems that is replaced by /, that made it work. sysctl net.ipv4.conf.eth2/1.proxy_arp
Enabling proxy_arp for interface eth2.1
1,375,797,819,000
OS: AIX 7100-04-1216 So basically I'm trying to write a for loop that sees which volumegroups I have on my system, which filesystems reside in those volume groups and what the size of each of those filesystems is. I have following code: for LINE in `lsvg` ; do echo "Volume Group: "${LINE} for LINE2 in `lsvgfs...
First a note on style. Using a for loop to iterate over lines of output is rarely a good idea. The for loop will split its input on whitespace so if you have more than a single word per line, it will break each into a different variable.You should use while instead since this deals with whitespace more gracefully. Als...
Run command based on output of another command
1,393,375,604,000
My first question on this site, I come quickly. I'm a fan of command line tools and text-based application. I use tmux with a minimalist tiling wm is qtile, I can not change the environment. I'm a developer, I mainly use Python and Perl. My first question is about mutt a great client. I use the sidebar to be able to d...
It's a little hard to see what you are trying to do, but are you by any chance looking for the $spoolfile variable/configuration setting in a global context? I'm not sure how it interacts with Mutt's IMAP support, but it allows you to set the folder which will be opened by default when Mutt is started. It looks like y...
Mutt imap multiple account
1,393,375,604,000
I want to quickly compare files in two different directories to see if the files are the same (same content). I want to see the results in Kompare (I'm on KDE - Kubuntu 12.04). Here's my diff command: diff -EwbBsy /directory/one /directory/two (That command would suit me even better if it ignored any files in /direct...
It doesn't seem to be able to handle the -y switch which does the side-by-side style of diff, but you can use the unified diff (-u). You can't mix these 2 styles so it's either -y or -u. So doing this worked for me: $ diff -EwbBsu /directory/one /directory/two | kompare -o - This will not show the entire file with th...
How to pipe diff into Kompare?
1,393,375,604,000
I need to average upload and download speed using dstat -n. How can I add all the received and sent data sizes that appear after dstat -n, so that I can add them and find average upload and download speed over some period of time ?
As no one answered,I have figured it out. Here is how to do it. Let's say we need to average it for "2 min(120 sec)". First write it to a file named stat.txt.Refresh every second fro 120 times. dstat -n 1 120 >> stat.txt Add the columns of stat.txt awk -F" " '{t1=t1+$1;t2=t2+$2}END{t1=t1/120;t2=t2/120;print t1"...
Averaging output of dstat
1,393,375,604,000
I am trying to run oprofile on my ubuntu host but cannot find the vmlinux file. The set up sfor oprofile needs this file: As given here : http://oprofile.sourceforge.net/doc/overview.html#getting-started opcontrol --vmlinux=/boot/vmlinux-`uname -r` What should I do so that I can profile the ubuntu kernel. I am using ...
Under Ubuntu & variants, it's named vmlinuz. So your command line for oprofile becomes : opcontrol --vmlinux=/boot/vmlinuz-`uname -r
Trying to run oprofile on ubuntu kernel but cannot find vmlinux file
1,393,375,604,000
I'm trying to automate creating vhosts on my computer. This is merely a learning experience for bash scripting. I'm currently novice. I'm trying to learn more about awk, sed. Anyways, this is my conf file. What would be the most efficient way to find and replace from command line? I'll eventually replace some forms wi...
This looks like a job for a here-document: include the template in your script, and use $variable_name when you want to substitute variables, or $(shell-command) to substitute the output of any shell command. The here-document begins on the line after the marker <<EOF (you can replace EOF by any word) and ends on a li...
Templating values for a bash script for apache conf files
1,393,375,604,000
udisksctl is my tool of choice when dealing with file system images (recent example, but I've been doing this all over the place). The dance typically looks like fallocate -l ${img_size} filesystem.img mkfs.${fs} filesystem.img # Set up loop device as regular user loopback=$(udisksctl loop-setup -b "${img_file}" | se...
I feel your pain... I also love the sudo-less power of udisksctl, I use UDisks2 in several snippets and projects, and I also hate how "machine-unfriendly" its output is. That said, one approach I'm leaning towards to is not to parse the output of udisksctl mount,loop-*,..., use it for actions only, and leave parsing t...
udisksctl: get loop device and mount point without resorting to parsing localized output?
1,393,375,604,000
When in the graphical environment, seahorse unlocks my ssh key (locked with a passphrase) so I can ssh to another host without entering a passphrase. But when on the command line, I am still asked for such a passphrase. Is there a way to have ssh-agent unlock my key on login the way seahorse does? Also, what is the pr...
sudo apt install keychain and add if [ -z "$TMUX" ] ; then keychain -q ~/.ssh/id_rsa; fi . ~/.keychain/$(hostname)-sh 2> /dev/null to ~/.bashrc https://linux.die.net/man/1/keychain
Unlock ssh key on login
1,393,375,604,000
I'm trying to batch convert some Excel schedules to CSV format from the command line with the following LibreOffice command: libreoffice --convert-to csv *.xlsx I'm getting: error xsltParseStylesheetFile : cannot parse I/O warning : failed to load external entity "" error xsltParseStylesheetFile : cannot parse conv...
Are you obliged to use libreoffice? A great command-line tool to convert xlsx to csv is xlsx2csv Description: convert xlsx files to csv format xlsx files are zip archives where spreadsheet data is stored. In order to process a file, various bits inside the archive need to be located. This utility uses the Expat SA...
LibreOffice - convert Calc/Excel schedule to CSV from command line
1,393,375,604,000
I am trying to install a Let's Encrypt certificate on a Oracle Linux Server 7.6. Since the server does not have a public IP, I had to validate via DNS.I followed the instructions here https://github.com/joohoi/acme-dns-certbot-joohoi and the validation worked and I got the certificate. How do I now install the certifi...
I believe this should be comparable to CentOS 7.6. The path etc/ssl/certs is simply a symbolic link to /etc/pki/tls/certs/. The certificate is divided into two parts, the first which you have already mentioned is the *.crt file which contains the public key and shall be placed in /etc/pki/tls/certs/ which is in my cas...
Install Let's Encrypt SSL certificate on Oracle Linux Server
1,393,375,604,000
I use Debian 5. I was building GN. I followed the instruction provided here. I was executing these commands: git clone https://gn.googlesource.com/gn cd gn python build/gen.py ninja -C out While executing ninja -C out/ I receive this message: ninja: Entering directory `out/' [1/238] CXX tools/gn/input_file.o FA...
I solved this problem by avoiding clang compiler. I noticed that in build/gen.py there is option that gives me possibility to set compiler. By default it's clang. So in build/gen.py I changed this part that is below. def WriteGNNinja(path, platform, host, options): if platform.is_msvc(): cc = os.environ.get('CC...
/bin/sh: clang++: command not found
1,393,375,604,000
I have files .. 00016_0912RP10R6_RampMotorway9_0912RP10R6_13.646852_100.687103.jpg 00017_0912RP10R6_RampMotorway9_0912RP10R6_13.646956_100.686897.jpg 00018_0912RP10R6_RampMotorway9_0912RP10R6_13.647067_100.686684.jpg ... I would like to have 00016.jpg 00017.jpg 00018.jpg What is the best linux command to loop throu...
Using find: find . -type f -name '*_*.jpg' -exec sh -c ' for pathname do newname=${pathname##*/} newname="${pathname%/*}/${newname%%_*}.jpg" printf "Would move %s to %s\n" "$pathname" "$newname" # mv -i "$pathname" "$newname" done' sh {} + This would find the pathnames all regu...
Batch rename file by substring the filename
1,393,375,604,000
How do you start a specific web application created by GNOME Web via the command line? Usage example: The user creates a web application and wants to add that specific web application as a startup program (without opening GNOME Web)
I found the solution to my problem, but it's not very elegant. If you find a better and simpler way to do this, please share. Here it is: Go to: ~/.local/share/applications Open the file with your text editor. It's name will be: epiphany-yourAppName-RandomAlphanumericalCharacters.desktop Copy the text following "...
Start a GNOME Web (Epiphany) "web application" via command line
1,393,375,604,000
I have a script I class like so gitploy up -t 2.0.0 test_repo. I pull out the "action" up right away, then I need to be able to get the test_repo before I process the options. I don't want to lose that arguments in line, if that makes sense.. don't want to shift it away, just get it and let it be? Basically I want ...
Your requirements are logically contradictory. Given input like gitploy up -t 2.0.0 test_repo, you need to parse the options, and in particular notice the presence of the -t option and the fact that it takes one argument, in order to identify that the first non-option argument is test_repo. So first parse the options ...
get first CLI argument after the options in shell scipt
1,393,375,604,000
I am an absolute beginner at UNIX scripting (and have searched here for something explaining how to do this in a simple way to no avail). I am trying to pipe the contents of a claimName.txt file find . -name 'claimName.txt' -exec cat {} \; into a Node.js script that takes this value after a -c flag npm run import -- ...
You can use this without a pipe: npm run import -- -r ./ -c "$(find . -name 'claimName.txt' -exec cat {} \; -quit)"
pipe the output of cat into a node script
1,393,375,604,000
I'm trying to do the following for a while but without success. The data I received has comma separated values in each separate columns. The first value in column 6 before the comma is always related to the first value in column 7 before the comma. I want to extract data and put them into a table in the right order as...
With awk: awk '{split($6,a,","); split($7,b,","); for(i in a){print $1,$2,$3,$4,$5,a[i],b[i]}}' file awk reads the input space or tab delimited, default: [\t ]+. split($6,a,",") split the 6th field $6 separated by comma , and store the output in an array called a. split($7,b,",") split the 7th field $7 separated by ...
Processing table with comma separated values in different columns
1,393,375,604,000
Is there any technical merit/necessity to numerous *nix commands (mkdir, mkfifo, mknod) having a -m (--mode) option? I ask this because near as I can tell, umask (both the shell command and the syscall) provides everything you need to control a file's permissions: For example, I can do this: mkdir -m 700 "$my_dir" .....
There are things you can't do with umask alone: create a regular file with permissions above 0666. create a directory with permissons above 0777. So you do need chmod or --mode as well. If, for security reasons, you never want to create an object with temporarily higher rights than intended, chmod without umask isn'...
umask vs -m, --mode command options
1,424,365,645,000
There are many Clipboard Manager for Unix-based Operating System but is there a way to actually know which one is being used? I am on Fedora 20 under Gnome 3.10.1 and I know that I'm using GPaste 3.10. But I would like to know if there is a command line which would ouput GPaste 3.10 (except gpaste --version obviously...
After doing an extensive search I wasn't able to find a method for doing this. So it would seem impossible to find out what downstream tools are collecting the results of the clipboards in an attempt to provide a "management" facility around them.
Knowing default clipboard manager
1,424,365,645,000
I'd like to try to stress-test a PHP script I've written, which accesses the filesystem, to see how it copes with load and parallel access. I'd like to run this script x times in y different processes parallelly. Is there a tool for this?
xargs allows easy parallel processing. Here is an example (which assumes that your version of xargs supports the -0 switch, which is not a POXIX requirement. If portability is an issue, simply use echo and drop the -0). maxruns=2000 instances=50 printf '%s\0' {1..$maxruns} | xargs -0 -I, -n 1 -P $instances <program> ...
How can I stress test a command line tool?
1,424,365,645,000
I am looking for a substitution of the W3C RDF Validator, as it is broken, in addition I want something a bit more automated, such as a command line tool. I have been using xmllint for checking XML files in the past. Are there any command line tools similar to that?
You can use rapper tool for validation or http://jena.sourceforge.net/Eyeball/
Is there a command line tool for validating RDF files?
1,424,365,645,000
I use RHEL 6 as my regular operating system and for one of my user accounts I made one of the desktop panels as auto-hide and other as a fixed panel. I expected the hidden panel to appear above the fixed panel but was surprised to see a clash of both the panels in the same space (bottom). This has caused me to not get...
Do following vim /home/<username>/.gconf/apps/panel/toplevels/bottom_panel/%gconf.xml or vim /home/<username>/.gconf/apps/panel/toplevels/top_panel/%gconf.xml If you renamed your panel, change top_panel or bottom_panel accordingly. Look for orientation section <entry name="orientation" mtime="1356417211" type="strin...
How to change the properties of a desktop panel from the command line?
1,424,365,645,000
I used to use Up/Down to move through the history of commands. Then, a few days later it changed to Ctrl-p/Ctrl-n. Now this also doesn't work to move through the history of commands entered. How can I view all these settings or change it? I tried to see the terminal setting by giving the command stty but it was of no ...
You are using ksh (the Korn shell). This shell is fairly primitive in terms of command line capabilities, but do check the “key bindings” or “line editing” section to see what your version of ksh can do. History navigation with Ctrl+P and Ctrl+N works in all ksh versions that I know of. They might be disabled in a con...
Moving through history of commands on command line?
1,424,365,645,000
I have about 15 instances of screen running on my linux server. They are each running processes I need to monitor. I had to close terminal (hence the reason I launched screen). Is there a way to reopen all 15 instances of Screen in different tabs without having to open a new tab, login to the server, print all the a...
This python script just did the job for me. I made three screen sessions and this fires up three xterms with the sessions reattached in each. It's a bit ugly but it works. #! /usr/bin/env python ...
How to resume multiple instances of Screen from command line with minimal steps?
1,424,365,645,000
There was such tool but I cannot remember its name. I needed to configure precedence of addresses by /etc/gai.conf. I finally managed to find an error, but for future, what's the name of tool which displays the addresses of hostname as getaddrinfo(3) displays it?
I know there is a tool resolveip for this that comes with MySQL. It should also be dead-simple to write something with e.g. Python or Perl...
Testing precedence of resolving addresses from commandline
1,424,365,645,000
I recently installed Fedora 36. I have a script that plays certain sound files. The script was used under Ubuntu 20.04 before, showing the expected behaviour. Inside the script, I use the following command: paplay --volume=65536 -d alsa_output.pci-0000_33_00.6.HiFi__hw_Generic_1__sink ~/soundfiles/notification.wav On...
I had the same issue but found this thread, and switched to pw-play. I realized something like this snippet works as expected: pw-play --volume=0.5 ~/soundfiles/notification.wav
paplay: --volume option does not take effect
1,424,365,645,000
I'm using neomutt (an updated fork of mutt) as my CLI MUA (read: mail reading software in the terminal) and have all my messages synced offline using isync/mbsync and stored in the maildir-format on my Debian Stable system. Sometimes I want to reply to a message and attach another email (e.g. as a reference). This ca...
I just stumbled onto a solution: before sending the email, instead of pressing a to attach a file you can use A to select a mail folder, then using t to tag one (or multiple) messages and then attach the selected messages using Return.
Display name and/or path of currently viewed email in mutt/neomutt
1,424,365,645,000
I'm trying to setup mailx to use my Gmail account. I've found a configuration that can send mail successfully but it requires me to store my email password in a configuration file in my home directory. I would like to be prompted for the password every time rather than storing it. I've tried leaving out the smtp-auth...
Which version of mailx are you using? heirloom-mailx 12.5 on Ubuntu 14.04 prompts me for the password every time if there's no smtp-auth-password setting in ~/.mailrc. This feature was added in 12.0 in March 2006 according to ChangeLog.
Using mailx without storing a password
1,424,365,645,000
I have an input RTSP stream that I want to apply the "cartoon" gradient filter to before streaming on http. I've managed to stream and apply the filter to the local playback, but the http stream does not have the filtering applied. cvlc -vvv input_stream rtsp://10.217.12.20:554/axis-media/media.amp?videocodec=h264 --v...
I managed to get this to work: cvlc -vvv --daemon --pidfile ./coffee_stream.pid rtsp://10.217.112.30:554/axis-media/media.amp?videocodec=h264 --sout="#transcode{vfilter=gradient{type=1},vcodec=theo,acodec=vorb,vb=800,ab=128}:standard{access=http{mime=video/ogg},mux=ogg,dst=:8091}"
How do I re-stream a filtered video stream using VLC?
1,353,826,112,000
Is there a lightweight virtualized Linux or other unix environment that I can run on the iPad? Like VirtualBox for iPad. I only really need a minimal system — something along the lines of Microcore Linux, so no X server or anything like that. Just a console with a reasonable C compiler; if gcc is not available, tcc (T...
While I think this should be feasible, it is very unlikely even on a jailbroken iPad, and extremely unlikely on a non-jailbroken device. Get a Linux VPS or a system to which you can SSH to, and install iSSH on your iPad, it's as closest as you can get to Linux-on-iPad.
Virtual unix command-line environment on the iPad
1,353,826,112,000
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 will be on the external drive and will only allow a specific user to be allowed to access the drive, thereby preventing o...
You can create an encrypted disk image on your external drive, which will require a password to mount. As long as you don't give out the password, other users will not be able to mount the image. See: http://support.apple.com/kb/ht1578 for details. Basically, you use Disk Utility located in the Applications -> Uti...
Restricting access to files on an external drive
1,353,826,112,000
Please do not ask why, but is it possible to do it? p/s: I know it's not a good thing, let's just say someone from the top management who is computer illiterate want some sort of control over the server.
Don't do that... you can either give them root's password or you could execute sudo passwd root (this assumes that sudo is set to use the users password or no password, and that passwd is a command that sudo has authorized to be run by that user).
How to give a normal user permission to change root password
1,353,826,112,000
Let's say I have a command accepting a single argument which is a file path: mycommand myfile.txt Now I want to execute this command over multiple files in parallel, more specifically, file matching pattern myfile*. Is there an easy way to achieve this?
With GNU xargs and a shell with support for process substitution xargs -r -0 -P4 -n1 -a <(printf '%s\0' myfile*) mycommand Would run up to 4 mycommands in parallel. If mycommand doesn't use its stdin, you can also do: printf '%s\0' myfile* | xargs -r -0 -P4 -n1 mycommand Which would also work with the xargs of moder...
Execute command on multiple files matching a pattern in parallel
1,353,826,112,000
I have 2 files: $ cat file1 jim.smith john.doe bill.johnson alex.smith $ cat file2 "1/26/2017 8:02:01 PM",Valid customer,jim.smith,NY,1485457321 "1/30/2017 11:09:36 AM",New customer,tim.jones,CO,1485770976 "1/30/2017 11:14:03 AM",New customer,john.doe,CA,1485771243 "1/30/2017 11:13:53 AM",...
This is virtually the last step in my answer to your earlier question. Your solution works, if you add -f in front of file1 in the grep: $ cut -d, -f3 file2 | grep -v -f file1 tim.jones bill.smith With the -f, grep will look in file1 for the patterns. Without it, it will simply use file1 as the literal pattern. You m...
Piping sed to grep does not seem to work as expected
1,353,826,112,000
I'm trying to use find to return all file names that have a specific directory in their path, but don't have another specific directory anywhere in the file path. Something like: myRegex= <regex> targetDir= <source directory> find $targetDir -regex $myRegex -print I know I might also be able to do this by piping one...
As Inian said, you don't need -regex (which is non standard, and the syntax varies greatly between the implementations that do support -regex¹). You can use -path for that, but you can also tell find not to enter directories called bad, which would be more efficient than discovering every file in them for later filter...
Find: Use regex to get all files with specific directory name in path, but without another specific directory name in path
1,353,826,112,000
I wonder what is a simpler way to do this: awk 'NR > 1 {print $1"\t"$2"\t"$3"\t"$4"\t"$5"\t"$6"\t"$7"\t"$8"\t"$9$10$11$12$13$14$15$16}' file.in > file.out which is simply speaking " concatenate columns 9 to 16 by removing tabs in-between" Merged columns 9-16 become "Notes" so may include whitespaces. As of today t...
paste <(cut -f 1-8 file) <(cut -f9- file | tr -d '\t')
awk / sed / etc. concatenating colums in one file
1,353,826,112,000
I was reading a book published in 2018 titled "Linux Basics for Hackers: Getting Started with Networking, Scripting, and Security in Kali" from no starch press. And this was written there that you can move up as many levels as you want using the corresponding number of double dots separated by spaces: You would use ...
This is an error in the book which the publisher addresses in the "Updates" section on the book's "homepage" (https://nostarch.com/linuxbasicsforhackers#updates): Updates Page 7 The following text regarding moving up through directory levels is incorrect: You would use .. to move up one level. You would use .. .. to...
Has "cd .. .. .." ever worked for going up 3 directories?
1,353,826,112,000
The actual data is: Dolibarr techpubl http://techpublications.org/erp tekstilworks.com WordPress tekstilw wbq.dandydesigns.co WordPress cbeqte WordPress cbeqte http://wbq.dandydesigns.co WordPress cbeqte ...
Using awk: awk '$1 ~ /\./' input-file-here The period in the awk expression has to be escaped with a backslash so that it's not treated as a regular expression syntax.
Extract a line if the first field contains a dot
1,353,826,112,000
so i have this command ps ax | grep apache | awk '{ print "cat /proc/"$1"/status | grep State" }' which outputs something like cat /proc/9989/status | grep State cat /proc/9992/status | grep State cat /proc/9993/status | grep State cat /proc/9994/status | grep State But i'd love to go one step forward and execu...
In addition to piping the commands to a shell as icarus correctly said, awk can execute a shell command itself: ps ax | grep apache | awk '{ system("cat /proc/"$1"/status | grep State") }' But you don't need cat because grep can read a file as RomanPerekhrest quietly showed: ps ax | grep apache | awk '{ system("...
command | grep | awk | ..... how to execute
1,353,826,112,000
I'm trying to return a boolean if a curl response has a status of 200. curl https://www.example.com -I | grep ' 200 ' ? echo '1' : echo '0'; This however brings back: grep: ?: No such file or directory grep: echo: No such file or directory grep: 1: No such file or directory grep: :: No such file or directory grep: e...
Like a quick study of the grep manual page should reveal, it allows for options, a search pattern (multiple patterns if you specify multiple -e options), and an optional list of file names, falling back to reading standard input like many other Unix filters if no file names are specified. There is nothing about a ter...
Grep Ternary Curl Reponse [duplicate]
1,353,826,112,000
Here's a layup for someone... I'm having to run a command repeatedly: $ wp input csv MyCSV01.csv directory_name $ wp input csv MyCSV02.csv directory_name $ wp input csv MyCSV03.csv directory_name The only change is the filename is incrementing. How can I run all these back to back? Perhaps find all the files that sta...
for i in {01..20}; do #replace with your own range echo \ wp input csv "MyCSV$i.csv" directory_name done Comment out the echo line if it gives you the results you want. zsh, which you tagged your question with, has a shorter form: for i (MyCSV{01..20}.csv) wp input csv $i directory_name Or you could use its z...
Repeating command with different filenames
1,353,826,112,000
Is there a way in Linux to make sudo command to remember the password the user entered for in the first of the lines? For example, for a list of commands that the user has to enter, the some of then requiring a sudo prefix, how can one make sure that if the user copy+pastes the instructions into a terminal all in one...
Double sudo is not necessary: sudo sh -c "apt-get update && apt-get -y dist-upgrade && apt-get -y autoremove && apt-get autoclean" This works fine even if one command can take very long.
sudo to remember password for list of commands?