date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,499,006,042,000
According to this article I used successfully the command $ ffmpeg -vf "select='eq(pict_type,I)'" -i somevideo.mp4 -vsync 0 -f image2 /tmp/thumbnails-%02d.jpg I tried the second command: $ ffmpeg -vf "select='gt(scene\,0.9)'" -i somevideo.mp4 -vsync 0 -f image2 /tmp/thumbnails-%02d.jpg but ended with error: Undefine...
First of all, -vf needs to be specified after the input in order to affect it, and it seems to be the only reason avconv worked for the second command: it must have discarded your filter without even parsing it. If you move the argument after -i, it will result in the same error as ffmpeg gave you. Newer versions of f...
Incorrect scene change detection with avconv
1,499,006,042,000
I have some Picture, that I want have in black and white. I'am in the right folder. -rw-r--r-- 1 alex alex 1027 Jan 21 13:07 target-0.jpg -rw-r--r-- 1 alex alex 1001 Jan 21 12:17 target-1.jpg -rw-r--r-- 1 alex alex 957 Jan 21 12:17 target-2.jpg -rw-r--r-- 1 alex alex 982 Jan 21 12:17 target-4.jpg Why do this n...
You do not pass the variable i to your mogrify command in the for loop. It should be as follows. for i in *.jpg ; do mogrify -monochrome "$i"; done
mogrify -monochrome to several Picture
1,499,006,042,000
How to input text into a new text file using nano from command line? I would like the same as with the following, but using nano: echo 'Hello, world.' >foo.txt Result: nano is not capable of handling non-interactive text input. echo is available in every Linux/Unix system, while nano is not installed by default in ...
You can use a here document but with this way it is not possible to provide a special output document. $ cat | nano <<-EOF one two three EOF Received SIGHUP or SIGTERM Buffer written to nano.save This behaviour is mentioned in the man page under notes In some cases nano will try to dump the buffer into an emerg...
How to input text into a new text file using nano from command line?
1,499,006,042,000
I'd like to print command output along with its input. For example for such call as echo "Hello world" | wc -c I want the following output: 12,Hello world Is there any way to do this using standard Unix (or GNU) tools?
tee and paste solution: echo "Hello world" | tee >(wc -c) | tac | paste -s -d, - 12,Hello world
Combine command output along with the input [duplicate]
1,499,006,042,000
I've installed some utilities from the CLI and got quite a long verbose output describe what was installed directly, what needed some dependencies, what is no longer needed to be installed, etc. Is there a way to grep something from this last command ? A very certain word I need. Thanks,
I needed something that does that after I ran the installation command, and not for to-come installation commands. While I don't know a command to do it after the instillation command has been executed, what I did was to copy the output from Bash itself, into a text editor like Vi or Nano, and then search for all inst...
Grep something specific of the results of last execution?
1,499,006,042,000
I have a file containing a set of information as below: cat filename 1 S121 2 M121 3 MS121 4 SM154 5 SM91 I am trying to change only all of those which has [mM] to MS plus keeping the same pattern. The following sed script was tried sed -r 's/ms?([0-9])/MS\1/Ig' filename but it is no...
You are matching a substring, starting with "m", optionally followed by "s", and then followed by a digit [0-9]. The text on lines 4,5 does contain this substring too: 4 SM154 5 SM91 so they are replaced. Try prefixing your pattern with "\s" to indicate that you are only interested in the prefix of column #2, lik...
How to use appropriate regex to find a pattern in sed?
1,499,006,042,000
I'm not going to lie. This is for an assignment. I'm stuck and its kind a frustrating so i came here as my last resort so please help me out. So, I need to make a script to find and print, that if the path is a relative or absolute path. I'm stuck in the last part where the prof want's me to do a command line substitu...
The script is far from ready, but you're on the right track now. if [ "$#" -ne 1 ]; then echo 1>&2 "$0: please insert one valid file name;found $# ($*) " echo 1>&2 "Usage: $0 [Filename..]" exit 2 fi if [ -z "$1" ] ; then echo 1>&2 "$0: file name cannot be empty; found $# ($*) " echo 1>&2 "...
a command substitute
1,499,006,042,000
I have some text in a file copied to the clipboard via command line and I then wish to paste this content to a website. cat file | pbcopy /usr/bin/open -a "/Applications/Google Chrome.app" 'http://google.com/' (1) How do I paste to say google (if it's even possible)? (2) Is it possible to open a different website, ...
For sending keystrokes to a graphical application from a command-line program you can use xdotool (you may need to install it first). See the answer by Gilles to the question "How to send keystrokes (F5) from terminal to a process?" on Unix & Linux.
Is it possible for command line to open a website and paste the clip board to a text box?
1,499,006,042,000
The output I get from a capture of the file browser: xwd -name "CVandXdo - File Browser" -out capture.xwd Doesn't match the specification defined for xwd files. I plan on parsing the output for an image recognition program. But I cannot localize the xwd header. I need to know where the pixels start and how many rows...
The include file /usr/include/X11/XWDFile.h which is part of X11 holds more information. I found this file in rpm xorg-x11-proto-devel on my system. In particular, the HeaderSize which your link says is always 40 is incorrect. The header file says header_size = SIZEOF(XWDheader) + length of null-terminated window name...
xwd output - unknown header
1,499,006,042,000
I have thousands of csv files in some directories. Out of which I would like to copy one csv file to remote machine on same path, if remote machine doesn't have directory then it should create directory and copy it to that path. Let me elaborate with example, say I have file called foo.csv in some directories test/ ...
Setup, done on my Vagrant box: $ mkdir -p test/20{1512,16{01..12}} $ for d in !$; do printf 'I am a csv file in %s\n' "$d" > "$d"/foo.csv; printf 'I am a different file; do not copy me!\n' > "$d"/abc.csv; done Directory structure after setup: [vagrant@localhost ~]$ tree test test ├── 201512 │   ├── abc.csv │   └── fo...
copy files remotely on same path
1,499,006,042,000
I do wish to modify a Mac OS X sandbox file via a one-line (copy and paste) command, by inserting a new line — containing a regex — after a line that contains a specific string (also being a regex pattern). The file to edit requires root rights and is located at /usr/share/sandbox/clamd.sb. Both search and append line...
You can't do this with macOS Sed, because it strips leading whitespace from the lines that you are inserting. Is it portable to indent the argument to sed's 'i\' command? Using Awk: awk '/\(regex #"\^\/private\/var\/clamav\/"\)/ {print "\t(regex #\"^/System/Library/PrivateFrameworks/TrustEvaluationAgent.framework/Ve...
One-liner to insert a new line of text (literally a regex, thus many to be escaped characters) in a configuration file before a specific string?
1,499,006,042,000
I'm using macOS Sierra and I would like to log a process with the top command and store all the information in a file. I'm using the following command: top | grep --line-buffered "PROCESS" > test.txt This perfectly works, but I would like to select only certain columns as the reseults: PID Memory Usage CPU Usage Net...
You can run this command in a loop. top -l 1 | grep "PROCESS" | awk '{print $1,$2}' >> test.txt Use awk to select the respective columns you want to include in your logs. For example, $1 is the first column, $2 is the second and so on.
filter top result
1,499,006,042,000
I was using an at command in my bash profile to echo the time of day at every hour to remind me of the time but now when I open up the command line it flashes a lot of annoying warning like these: warning: commands will be executed using /bin/sh job 241 at Thu Sep 1 00:00:00 2016 warning: commands will be executed u...
echo "midnight" | at 00:00 2>/dev/null
Removing the warning message that pops up when using an at command [duplicate]
1,499,006,042,000
I am trying to batch rename the following files: art-faculty-3_29060055362_o.jpeg fine-arts-division-faculty-2016-2017-5_29165851925_o.jpeg theatre-faculty-2016-2017-1_29132529356_o.jpeg art-history-faculty-2016-2017-1_29060057642_o.jpeg music-faculty-2016-2017-1_29132523816_o.jpeg I would like to rename...
for i in *.jpeg; do echo mv "$i" "${i%faculty*}faculty.jpeg" ; done if okay as per requirements, remove echo to change the file names The perl rename command on my system has only the options -v -f -n $ rename -n 's/faculty\K.*(?=\.jpeg)//' *.jpeg art-faculty-3_29060055362_o.jpeg renamed as art-faculty.jpeg art-hist...
Rename command to delete substring
1,499,006,042,000
Given an input file which consists of lines of IP addresses and strings, how can I loop through each line, and execute a command using the IP address and string? An example of the command that I want to run for each line is: ssh [email protected] cat /etc/component10/version | grep 'Version\|Project' >> /tmp/componen...
The following code will do what you want. while read -r server _; do ssh -n -o StrictHostKeyChecking=no root@"$server" "grep -E 'Version|Project' /etc/component10/version" >> /tmp/component_ver.txt; done < serverfile
How to read input file and act on each line
1,499,006,042,000
Source Community I've been trying to figure out an ffmpeg command with following requirements while converting 'avi' to 'mp4' with H264 video codecs. One command I tried was generic one like this which is recommended on most forums. ffmpeg -I input.avi -acodec copy -vcodec copy output.mp4 But this copies same video c...
Let us enumerate the parameters to ffmpeg then. -acodec is better written -c:a (menmonic codec for audio) -vcodec is better written -c:v (same mnemonic) -i is the input file (not -I) ffmpeg does a pretty good guesswork based on file extensions, therefore doing: ffmpeg -i file.wem file.mp4 Will convert things, but p...
Building Requirements-Specific Command For 'ffmpeg' Tool
1,499,006,042,000
Trying to get powerline/airline symbols to show in vim running in a Debian container created with sudo systemd-nspawn -D ~/debian-tree/ on a Fedora host. Right now it just shows question marks in diamonds (��) I'm pretty sure I need to set the locale but I can't find a straight forward answer on how to do this properl...
Setting the locale is documented in the Debian install guide - there's an appendix which provides some hints on installing directly with debootstrap and configuring the system yourself. To configure your locale settings to use a language other than English, install the locales support package and configure it. Curren...
Setting locale in a systemd-nspawn container (debian jessie)
1,499,006,042,000
I have a file with 21 tabular fields in columns. Tabs 14 and 15 are sets of data which are repeated several times for variables in tab 10(up to ":") and tab 11 has numeric descriptive data for tab 10 . Here's an example of the input: 399 3 0 0 0 0 0 0 - chromosome_1_Contig0.1980:10701-11103 402 0 4...
You can use split to extract the two parts of field 10 into an array (here called arr10) like this: split($10, arr10, ":") Then you can build an index out of a combination of the first element of that array and the whole of element 14. Using that index, you can build two new arrays, e.g. sum_of_11 and old_15: sum_of_...
awk to consolidate large tabular file?
1,465,383,627,000
My files masi1.jpg masi2.jpg masi3-1.jpg masi4.jpg ... masi10.jpg masi11.jpg ... Command pdfjam *.jpg. Output: random. Expected output: as the list. There is no parameters in man pdfjam, only synapsis pdfjam [OPTION [OPTION] ...] [SRC [PAGESPEC] [SRC [PAGESPEC]] ...] System: Ubuntu 16.04. Pdfjam: 2.08.
Wildcard matches are sorted in lexicographic order, so 10 is between 1 and 2, not after 9. To sort matches with numbers in numeric order, use zsh and its n glob qualifier pdfjam *.jpg(on) Or (still zsh-only) set the numeric_glob_sort option: setopt numeric_glob_sort # this can go in your ~/.zshrc pdfjam *.jpg If a...
How to pdfjam by Filename Numbering?
1,465,383,627,000
I want to test a speed connection with terminal command: ./speedtest-cli And it returns This: Retrieving speedtest.net configuration... Retrieving speedtest.net server list... Testing from Moscow, Russia (77.50.8.74)... Selecting best server based on latency... Hosted by East Telecom Ltd (Mytishchi) [10.81 km]: 7.43...
awk -v date="$(date +%d-%m-%Y\ %H:%M)" -v OFS=';' '/Download:/ { d=$2; } /Upload:/ { print date, d, $2, ""; d="" }' speedtest
Convert command output to csv, with time stamp
1,465,383,627,000
I have a directory with the following layout (the layout in Directory 1 is repeated in every other Directory <num>): Parent directory Directory 1 some directory another directory <many files> Directory 2 ︙ Directory 3 Directory 4 I'd like to rename the files by prefixing t...
First of all, I can’t reproduce the results you claim for the command you showed.  I got the files being renamed to another directory_file1.jpg, another directory_file2.jpg, etc., but still under the some directory directories. Secondly, because of the depth of your directory structure, you should be using -mindepth 4...
Move files several directories up for several directories with similar layout
1,465,383,627,000
When I am typing in a path at the bash prompt I sometimes do not remember what the directories are so I cannot incrementally search for them. Is there a way in readline to cycle through the possibilities or list them?
Completion does this. Press Tab to list the files starting with the part of the word containing the cursor up to the cursor. That is, if the cursor is at | in xdg-open fo|.pdf, then pressing Tab lists all the files beginning with fo, whether they have the .pdf extension or not. This makes completion most useful when y...
View path options when using readline?
1,465,383,627,000
I was wondering if any of you knew why doesn't my terminal keep displaying stuff colored, after I use the command ls -l -a --color=always I would like it to stay colored, so when the next time I type ls -l -a it is colored. Just to make it clear, I'm using Windows 10, and then with putty I SSH into a server, where I h...
Once the output of ls is on the terminal, it stays colored. But if you run ls again, whether the output is colored depends on the options you pass to ls this time. The ls command doesn't remember settings from one time to the next. If you want to have default settings for a command, define an alias for it. For bash, t...
Terminal color usage does not stay
1,465,383,627,000
Of all screen-shot tools that I have seen in Linux, the KDE one (ksnampshot) looks the most powerful. ksnapshot --region is a command that I can associate with a shortcut to capture a selected region without opening the Ksnapshot GUI. The GUI, on the other hand, has a supplementary option of setting a delay for captur...
There are several ways, the most simple probably sleep(1): sleep 1m && ksnapshot --region ... Using && instead of ; has the added benefit of the possibility to cancel the command with CTRL C.
CLI command to capture region with delay?
1,465,383,627,000
I'm using an AWS EC2 instance and I'm trying to switch from an Ubuntu instance to a Linux (Amazon Linux AMI) instance and in doing so I need to figure out the equivalent apt-get to yum commands and packages to install. In essence how would you translate the following from apt-get to yum? Side note assume I have alrea...
Various distros name their packages slightly differently and there is no automated way to map one to the other. You've probably quoted the best example already with Apache, which is apache2 on Debian/Ubuntu systems and httpd on CentOS/RedHat/Fedora systems, apache on Arch, apache2 on openSuse, www-servers/apache on G...
Linux yum Commands that are Equivalent to these Ubuntu apt-get Commands [closed]
1,465,383,627,000
I am trying to print a tshark command output using awk below is my command: tshark -r "test.pcap" -odiameter.tcp.ports:"1234" -R 'diameter.cmd.code == 272 and diameter.flags.request==0 and !tcp.analysis.retransmission and diameter.flags.T == 0' -Tpdml -Tfields -ediameter.Session-Id -ediameter.CC-Request-Type -ediamete...
Based on your tshark parameters, I'm guessing you are trying to output 6 specific fields, and one of them is empty. tshark by default uses a TAB character as separator, so the output will contain two consecutive TAB characters (indicating a missing value). awk however, by default treats multiple tab/spaces as one fiel...
Want to print NULL if value is not present as awk output
1,465,383,627,000
I have a number of files that are saved as Year -> Month -> Day -> bunch of .nc files I would like to generate a list of all of the directories that contain the nc files. I can list the path of each nc file with: find /Year/ -name *.nc | sort > directory_list.txt which finds each .nc file in the sub directories of ...
find /Year/ -name '*.nc' | sed -e 's:/[^/]*$:/:' | sort -u Will give you the list of directories which contains at least one file whose name match '*.nc'
path of folder within a folder in terminal
1,465,383,627,000
I am attempting to create a Custom Action in Thunar (File Manager) that will extract a gzip archive into a subdirectory of the same name (e.g. abc.tar.gz to abc/). I created this command, which works, although it puts single quotes around the file name (e.g. 'abc'/ instead of abc/). I ran the equivalent command manual...
I would try removing the quotation marks around %n. It appears that thunar puts its own marks there, which is why you have them in the folder name. Also, when you check thunar's examples, they never put the marks around expanded variables.
Thunar custom action: Extraction to subdirectories
1,465,383,627,000
Consider the following setup: My laptop is normally located at my desk connected to power, external keyboard and mouse and an external monitor. Since the laptop's screen is pretty small and my monitor is pretty big, I work with the laptop screen turned off using only the external monitor. Recently I wanted to take the...
xrandr should be what you are looking for. Also, you may need to review the instructions Multihead instructions. I have had good luck with xrandr on gnome 3 but it should work fine with KDE.
Is there a way to change KDE4 display settings from the command line?
1,465,383,627,000
I have a folder that i want to zip but not deflate the soundfiles (since i'll create an expansion file for android). TO achieve that one can use the -n flag. that is zip -n .mp3 main_expansion thaisounds then a new zip-folder is created where the mp3-soundfiles are stored but not deflated. The problem is that I also ...
According to my version of the zip man-page, you need to use colons to separate the suffixes: -n suffixes --suffixes suffixes Do not attempt to compress files named with the given suffixes. Such files are simply stored (0% compres- sion) in the output zip file, so that zip doesn’t waste its ...
Zip several soundfile-formats without deflate
1,465,383,627,000
I'm trying to use the output of a command as arguments: The command: /home/alexandre/dropbox.py exclude add ls | grep -v photos I have to add a list of files, for example: /home/alexandre/dropbox.py exclude add a.txt b.txt c.txt ls | grep -v photos will give me a list of all files except the folder photos. But if I us...
What you are looking for is to execute the command in a subshell, like: /home/alexandre/dropbox.py exclude add $(ls | grep -v photos)
pipe as arguments
1,465,383,627,000
Earlier, in my shell, on pressing TAB, I would directly see the directory path completed to the best length possible. But now, after upgrading to centos-6 I see that it also prints all possible names from the current directory and then completes the command which seems to be unnecessarily take up space in my shell as ...
Have you tried unset autolist? Test it on the command-line and if it works, add it to your ~/.tcshrc see man tcsh and search for Completion and listing for more details on completion and on what autolist does.
Disable printing all possibilities in tcsh on TAB
1,465,383,627,000
I want to know which executable gets executed for any command in bash. Example: I have firefox installed here /usr/bin/firefox, it is in the $PATH alias browser=firefox alias br=browser Now I want to type something like getexecutable "br" and it should display /usr/bin/firefox
Here's a quick script I wrote further to my comment, that in the SIMPLE case of aliases will work. For anything with arguments/etc., though, it will fail miserably. cmd="$1" type=aliased while [ "$type" = "aliased" ]; do output="$(type "$cmd")" type="$(cut -d ' ' -f 3 <<< "$output")" cmd="$(cut -d '`' -f 2...
Get executable for any command [duplicate]
1,465,383,627,000
I created mp3 files in Linux with the mp3wrap application and then I applied ID3 tags on it as follows: $ for i in *.mp3; do mp3info -t ${i%.*} -l yes1 -a yes $i; done When I look at a particular mp3 file (e.g. ddi.mp3) it looks as follows: $ mp3info ddi.mp3 File: ddi.mp3 Title: ddi Trac...
AFAIK mp3info write only ID3v1 tags. You can check it with something like eyeD3 (a tool written in python): eyeD3 -1 file.mp3 (to check ID3v1) and eyeD3 -2 file.mp3 (to check IDv2, which is read by recent players). You can also use eyeD3 to write v1 or v2 tags. For instance, you can edit v2 tags with: eyeD3 -2 -a "Th...
Bad ID3 tags when transferring mp3 to another device
1,465,383,627,000
I have a program that runs from the command line. As soon as it runs, it asks for a text value and expects the return key to be pressed after that. Is that possible to create a bash script that runs that program, wait a little bit for the prompt to appear (lets say 2 seconds) and then provide the text and the enter ke...
It is working now, but I changed the script to: #!/usr/bin/expect -f set timeout 15 set user "myusername" set server "x.x.x.x" spawn ssh -l $user -p AAAA $server expect "[email protected]'s password: " { send "the password\r" } interact
Running a program and providing input
1,465,383,627,000
I saw this video on Youtube: Run Kali Linux on Android The phone uses the app: Linux deploy, which uses the phone to host the distro, but there's is no GUI. The only way to connect to Kali, is by using a vnc viewer. My question is: Is it possible to host a linux distro on e.g. an laptop or stationary, without GUI - on...
Yes. This is easy. Install the system with the GUI libraries for X (drivers optional) and for the desktop environment you want. Then, run something like the TigerVNC server, and you're done.
Host linux distro without GUI?
1,465,383,627,000
Does anyone know which command I need to enter on the terminal, so I can check whether all allocated memory was successfully freed?
In Linux you can use free to see the amount of memory used. Using free before and after a process was executed you might be able to see if all memory is released. Keep in mind though that other applications might have allocated or released memory in the mean time. If you want to monitor a process while it is allocatin...
How to check if allocated memory was freed?
1,465,383,627,000
I was wondering if there is an easy way to do the following without writing a script. Transform 1234,"a;b;d" 2345,"e;f;g;h" to 1234,a 1234,b 1234,d 2345,e 2345,f 2345,g 2345,h
Should be easy with awk: $ awk -F'[";]' -vOFS='' '{for(i=2;i<NF;i++)print $1,$i}' file 1234,a 1234,b 1234,d 2345,e 2345,f 2345,g 2345,h
Transform values in a line by first field
1,465,383,627,000
.. Script Run Complete. You have new mail in /var/spool/mail/<user-name> -bash-3.2$ I have seen the above message most the times on my prompt, probably while it's idle or as soon as script returns or just upon hitting return. I won't be needing it, at all. Is there any way/tweak to control whats being output on the ...
You have to do unset MAILCHECK. From the bash manual: MAILCHECK Specifies how often (in seconds) bash checks for mail. The default is 60 seconds. When it is time to check for mail, the shell does so before displaying the primary prompt. If this variable is unset, or set ...
How do I control output after executing a command?
1,465,383,627,000
Recently git branch <tab> started showing me the following error: $ git branch bash: -c: line 0: syntax error near unexpected token `(' bash: -c: line 0: `/usr/bin/git --git-dir=.git for-each-ref --format=%(refname:short) refs/tags refs/heads refs/remotes' HEAD bash: -c: line 0: syntax error near unexpected token `(' ...
Your script does not preserve quotes. The original line executed by completion is: git --git-dir=.git for-each-ref '--format=%(refname:short)' refs/tags refs/heads refs/remotes by your script you get: bash -c '/usr/bin/git --git-dir=.git for-each-ref --format=%(refname:short) refs/tags refs/heads refs/remotes' Note ...
Broken git autocompletion after I have overridden the git command
1,465,383,627,000
I have finally come up with a favourite PS1 format but I find it takes too long to load. The part that is slowing it down is when I call the external commands in the prompt. I simply want to show the # of entries and # of hidden files of the directory. I followed these 2 pages as a guide to make the prompt: "Externa...
count_glob() { [ -e "$1" ] echo "($v=$((!$?*$#)))+" } You could declare a function like the above. Then instead of ls and the rest you could just do... ...Currently in: $(($( v=c count_glob * v=h count_glob .* )-2)) entries and $((h-2)) are hidden... I only removed the escape sequences because the...
Command prompt (PS1) including the number of files in directory (both hidden and regular entries)
1,465,383,627,000
The below script is not working. cd desktop/quoteUpdate while true do curl-o quotes.txt -s "http://download.finance.yahoo.com/d/quotes.csv?s=goog,aapl&f=sl1" sed -i '.bak' 's/,/ /g' quotes.txt echo UPDATED: date sleep 10 done When I try and run the executable I get this error and no txt file is created in my desk...
You need to have spaces in the curl command. You should have curl -o instead of curl-o. If I include the spaces and run the command, I get the quotes.txt file as expected.
Using cURL command-line tool on Mac, how does one fetch stock data which comes back *without* commas? [duplicate]
1,465,383,627,000
I have a very important process which is having a Queue, In Queue i'm storing important data and when if someone trap that process it must have to process the data which is there in the Queue after that it will terminate itself. So if user perform a shut-down operation then that process will be killed and my data will...
If your software do a critical job you have to write a service file and put it under /etc/init.d that when computer goes down your script start stop function in that script which you need to clean up to not mess up your program. Like Oracle DB that when system goes down it will close ports to don't transaction any inf...
Is there any command in linux which will force linux machine to not shut-down
1,465,383,627,000
I use aliases a lot but right now only for use cases like alias i='sudo apt-get install -y'. I often would like to add an alias in the following form: alias cmd='echo [something] >> /path/to/file' where I would like to substitute [something] with what I enter after the cmd. I can obviously create a one-line script,sa...
Functions are perfectly suitable for this purpose. For example: cmd() { echo $* >> /path/to/file'; } This is on one line, just like an alias. But it can take parameters.
How do I make an alias to substitute single word in a piped command? [duplicate]
1,465,383,627,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. Inside the API I am using absolute path like '/root/virtman/manager/' . Consider running this API in any unix environment , how can I make this absolute path generic to any OS/mac...
If the path is only pointing to executables you call, you should consider putting links in standard locations during install (/usr/bin/ or /usr/local/bin) and have the executable find out where they were invoked from and then have them derive the path to any data files from that. You would use the following: /usr/bin/...
Maintain the path in installable UnixAPI
1,412,878,085,000
I downloaded Kali Linux from this link, I have a 32 bit OS, so I guessed ISO 32 Kali Linux is the suitable for me (they did not clarify in the website based on what we choose the type). Then, I installed Kali Linux on USB using 32 image writer. After that I changed the booting setting to boot from USB and this messag...
That was because the downloading was not complete, Although Chrome showed that it is complete I re-downloaded from another browser and it work fine now.
Kali linux throws ' isolinux.bin missing or corrupt ' error
1,412,878,085,000
There is a question about the group, but I couldn't find any question/answer for getting the Apache user. Therefore how to determine Apache user from the command-line?
You may try to use the following command-line method to find out your Apache user name: WWW_USER=`ps axo user,group,comm | egrep '(apache|httpd)' | grep -v ^root | cut -d\ -f 1 | uniq` echo Apache user is: $WWW_USER To get the Apache group, simple change the cut's field number from 1 to 2, see: How to check which A...
How to determine Apache user from the command-line?
1,412,878,085,000
I can open my terminal emulator via a keyboard shortcut or through the apps finder that executes the exo-open --launch TerminalEmulator command. My terminal starts and I can cd to any directory and execute any binaries located on any bin directory on my system. But whenever I launch it by right-clicking any directory...
I would say your running into a good old classic fight. To ~/.bashrc or to ~/.profile Checke your $PATH in both. Read and understand https://stackoverflow.com/questions/415403/whats-the-difference-between-bashrc-bash-profile-and-environment It may answer your question. Basically your logging in when your launch a te...
Terminal sometimes fails to find executables on local directory [duplicate]
1,412,878,085,000
I want to get list of URLs that contains vimeo.com from a web site recursively by a command , so that I can pipe it to vimeo_downloader.sh. I prefer to use wget, but also I'm happy with other options. Example index.html <a href="01.html">01</a> <a href="02.html">02</a> <a href="03.html">03</a> <a href="04.html">04</a>...
You need to get the list of URL's then parse out the links to feed to the download. As you are using an external program to do the downloading rather than wget you don't really need wgets recursive download options. Assuming GNU grep which allows you to print only the matching text you can grab the vimeo urls with: w...
How to get list of urls from a URL recursively with filtering
1,412,878,085,000
I want to alter the stored procedure in my server machine. I'm uploading the codes via SSH Linux command prompt, I need to alter an existing stored procedure in my server. I don't have c-panel or phpMyAdmin access. I have to update it via a command prompt. stored procedure DELIMITER $$ USE `dbname`$$ DROP PROCEDURE ...
If you have console access to your database you can load this file via the command line like this: $ mysql < /path/to/text_file.sql Where text_file is the name of the above file. If you're already at the mysql> prompt you can source the text_file using either of these methods too: mysql> source /path/to/text_file.sql...
How to alter stored procedure in a MySQL database using the Linux command prompt?
1,412,878,085,000
I want to be able to use notify-send to send popup messages from one server to be displayed on another. I'm sure this is possible with SSH, but how can I automate it to a one-line command that doesn't ask me for a password so I can include it into a script?
One way of doing this would be to use key-based authentication for the ssh connection. On the sending computer, create a public/private ssh keypair: ssh-keygen -f .ssh/notify-key -C "notify-send SSH key" -b 2048 -t rsa The program will ask you for a passphrase; simply hit enter twice to create an SSH key without a p...
Using notify-send with a non-interactive ssh connection
1,412,878,085,000
I don't have permission to mount a smb share with the mount command or by using /etc/fstab, but I'm able to use the smb protocol in Nautilus (smb://10.1.1.1/share), for example ... s Is it possible to grep a file or use any command in it in these conditions like I do in local files? I'm running openSUSE 13.1 with LXDE...
Nautilus uses GVFS internally. GVFS itself only caters for applications that use the Glib library to access files. Make sure that you have the gvfs-fuse package installed. This package contains the program gvfs-fuse-daemon which makes all GVFS filesystems available as normal mounted filesystems. gvfs-fuse-daemon shoul...
How do I grep a file in a smb mount point without using mount or fstab?
1,412,878,085,000
I am using Debian 7.2 and would like to know the shell command for finding the MAC time of a file or directory. I tried man -k "MAC" and got a lot of hits about macros. I then tried man -k "MAC time" and got nothing.
By MAC I assume you're asking about Modify, Access, and Change timestamps. You can get these from the stat command. Example $ ls -l LICENSE -rw-rw-r-- 1 saml saml 810 Jul 5 2012 LICENSE $ stat LICENSE File: `LICENSE' Size: 810 Blocks: 8 IO Block: 4096 regular file Device: fd02h/64770d In...
How can I finding the Modify/Access/Change time of a file or directory? [closed]
1,412,878,085,000
I wrote a little script to send multiple mails from a list with differents subjects. #!/bin/bash while read -a line do mailadd=${line[0]} subject=${line[1]} mutt -s `echo $subject` `echo $mailadd` < /home/emanuele/testomail.txt done < prova.txt The scripts works fine and sends the mails, but mutt tell me t...
First, `echo $subject` is a convoluted way of writing $subject (except that it mangles the value a bit more if it contains whitespace or \[*?, because $subject outside quotes is treated as a whitespace-separated list of wildcard patterns, and then the result of the whole command substitution is again treated as a whit...
mutt weird action
1,412,878,085,000
I am trying to setup real vnc server on my RHEL via command line. I have done the following steps Downloaded the Real VNC installer from Real VNC for Red Hat 64 bit system Unizipped it to get to rpms VNC-Server-5.0.5-Linux-x64.rpm,VNC-Viewer-5.0.5-Linux-x64.rpm The documentation did not have any command line installa...
You need to start vnc session from your Linux account to be able to connect to your session, run vncserver from your command line of your Linux system. After you issue this command it will tell you your session ID to connect. Here is an example: [root@systemname]# vncserver New 'systemname:1 (userna...
Configuring Real VNC on RHEL 6.3 Command Line
1,412,878,085,000
I am trying to execute date command in unix server for yesterday. The commands tried are : date --date ="1 day ago" date --date ="1 days ago" date --date ="yesterday date --date ="-1 day" These command work in a server but the same command does not work in few other servers, where date prints properly the current d...
Either remove the = or the space after --date and change those Unicode quotes (U201D) to the ASCII quote character (U0022). So: date --date="1 day ago" or date --date yesterday or date -d yesterday Note that -d/--date is not a standard Unix date option and is only available with GNU date. So if that Unix server is ...
Unix Date command not working for few servers
1,412,878,085,000
I would like to get netstat to not display port numbers on the foreign address so I can run some statistics on it. This is for a FreeBSD system. The following is a example of the output. <root>:/# netstat -an | grep .80 |head tcp4 0 0 61.129.65.176.80 123.120.207.172.51972 ESTABLISHED tcp4 491...
Add this sed command at the end of your pipe. It does a greeding search until last . and delete it and all digits that follow it. ... | sed -e 's/^\(.*\)\.[0-9]*/\1/' It yields: tcp4 0 0 61.129.65.176.80 123.120.207.172 ESTABLISHED tcp4 491 0 61.129.65.176.80 171.250.180.211 ESTABLI...
Have netstat not display port numbers for foreign address
1,412,878,085,000
I have a shell script to run JMeter test. Script generates the Jmeter log out put and creates sar (suppose to create sar file though it does not). Shell script is - runtest() { export JMETER_HOME=/home/software/apache-jmeter-2.6 host=$1 port=$2 loopcount=$3 logfile=jmeter$(date -d "today" +"%Y%m%d%H%M%S").jtl ...
There's a typo in your question: you set sarfile but use sar_file, which is probably causing your sar command to exit with an error.
Unable to kill sar process
1,412,878,085,000
I have had gnupod for a while. Still haven't figured out how to use it though. I usually just go for gtkpod. So this question, in case anyone had any doubts after reading everything below, is purely about gnupod syntax. Recently I decided to get my ipod replaced under this replacement scheme. (I don't like proprietary...
First, gnupod does not work directly with the iPod database, you need to convert from and to the gnupod database, so you want to run tunes2pod.pl first. This only needs to be done when you change the iTunesDB (iPod's own database) directly — if you use gnupod again without using other tool, you don't need to run this ...
Backed an ipod up with dd, how to retrieve all tracks in one go with gnupod?
1,412,878,085,000
Many laptops are delivered with Windows 7 recovery partition (but without CD or DVD) which takes place on the harddrive that could contain some Linux distribution or serve for data storage. I don't want to format it because sister paid for this partition and has a license key. But she would like to backup it to some m...
Using tar and gzip is probably your best bet. You could use dd to do a block-by-block copy of it but this will obviously give you a file exactly the same size as the partition. Assuming the partition is /dev/sda2, something like:- mkdir /mnt/recovery mount -t ntfs /dev/sda2 /mnt/recovery cd /mnt/recovery tar -cvf - . ...
Create recovery medium from Windows 7 recovery partition
1,412,878,085,000
I have a text file of a database dump with some line break characters (0x0A0x0D) in the middle of lines. I want to replace them with commas, but I can't do it simply, because those characters are the actual line break characters where I do want line breaks! But I noticed that the line break sequences I want to keep ar...
The regex for a whitespace character is, of course, \s. However, since you want a non-whitespace character, you can use \S! Therefore, your regex to replace would be \S\n\r\S. EDIT: #!/usr/bin/perl use strict; use warnings; my $pattern = "xxxxxxxxxxxxxxxxxxxy\n\ryxxxxxxxxxxxxxxxxxxx \n\r xxxxxxxxxxxxxxxxxxxy\n\ryxxx...
regex find and replace 0x0D, 0x0A characters
1,412,878,085,000
In vim I use the following command to compile a tex file: pdflatex\ \-file\-line\-error\ \-shell\-escape\ \-interaction=nonstopmode\ $*\\\|\ grep\ \-P\ ':\\d{1,5}:\ ' this works in terms of getting the errors into a quick fix window (if you don't use vim, ignore this sentence). The only problem is that I would like t...
Have you tried using errorformat instead of grep'ing the output? C.f. http://vim.wikia.com/wiki/Errorformats. It is specially useful if you set up the make command ( http://vim.wikia.com/wiki/Make_make_more_helpful ). Thanks for the updated output, romeovs. It sounds like you wish to have something like: set errorfor...
Display output to console while grep is used
1,412,878,085,000
I am using PuTTY to connect to a distant network to then set up x11vnc and then using ssl/sshvnc as a client. in the host name for PuTTY I have: ssh.inf.uk and port: 22 in the ssh tunnel options I have source port set to: 5910 and destination: markinch.inf.uk Then putty brings up an xterm and I am prompted for my use...
In your putty config, the traffic is exiting the tunnel at ssh.inf.uk and being forwarded directly to markinch.inf.uk. So you're only building 1 tunnel. In your ssh statements, you're building 2 tunnels - one from localhost to ssh.inf.uk, and a second from ssh.inf.uk to markinch.inf.uk. I haven't yet worked out why t...
vnc connection working with PuTTY but not with command line
1,412,878,085,000
man modprobe says in the ENVIRONMENT section: The MODPROBE_OPTIONS environment variable can also be used to pass arguments to modprobe. But this is unclear. Suppose for example that I want to force the module search path by faking the kernel version string. That is the -S option. Should it be: MODPROBE_OPTIONS='-S ...
The contents of MODPROBE_OPTIONS are prepended to any existing arguments, with no processing other than splitting on spaces. So if you want to end up with modprobe -S fake-version module-foo you’d set MODPROBE_OPTIONS="-S fake-version" and then (with the variable exported) run modprobe module-foo
Passing modprobe options through environment
1,412,878,085,000
I use a little script to numbering files. I start it with a thunar custom action. This only works when all files are in the same directory. the new files name are 00001.ext to 00005.ext when I rename 5 files. krename has an option to restart for every folder. When i have this /path/to/folder1/file1 /path/to/folder1/fi...
Using Perl's rename (usable in any OS): rename -n 's!folder\d+/.*!sprintf "folder1/%05d", ++$MAIN::c!se' ./folder*/* $ tree folder* folder1 ├── 00001 ├── 00002 ├── 00003 └── 00004 folder2 Remove -n switch, aka dry-run when your attempts are satisfactory to rename for real. To go deeper: you can capture folder with: ...
Numbering files and restart for every folder in command line?
1,691,420,788,000
I'm using a server where I'm a common user (non-sudo). I access the server through ssh. Here's the output of some commands run on the server: [username@machinename: ~]$ ps -p $$ PID TTY TIME CMD 1332818 pts/55 00:00:00 bash [username@machinename: ~]$ echo $$SHELL 1332818SHELL [username@machinename: ~]$ ...
I include this in ~/.profile # if running bash # include .bashrc if it exists [ -n "$BASH_VERSION" ] && [ -f "$HOME/.bashrc" ] && . "$HOME/.bashrc"
How to config alias on RedHat server?
1,691,420,788,000
# Create a folder mkdir archived_PA_2022-01_2022-06 # Move files to new folder find ./ -newermt "2021-12-31" ! -newermt '2022-06-28' -exec mv /var/log/pentaho/PA –t archived_PA_2022-01_2022-06 {} + # Archive folder zip -r archived_PA_2022-01_2022-06.zip /var/log/pentaho/archived_PA_2022-01_2022-06 I have this Unix...
I was able to figure it out. Just use: # Create a folder dynamically mkdir archived_PA_"$(date -d "6 months ago" +%Y-%m-%d)"_"$(date -d "1 day ago" +%Y-%m-%d)" # Move files to new folder dynamically find ./ -newermt "6 months ago" ! -newermt "1 day ago" -exec mv -t archived_PA_"$(date -d "6 months ago" +%Y-%m-%d)"_"...
How do I move files to new folder based on timestamp dynamically without manually changing the script?
1,691,420,788,000
Is there a way to create nested directories which all have the same user/group in a single command? That single command would have the same effect as the following two commands: mkdir -p new-1/new-2/new-3 chown -R myUser:myUser new-1
I can not add a comment, therefore I post this as an answer. Have a look at install, see man install(1). install -d -g myUser -o myUser new-1 new-1/new-2 new-1/new-2/new-3 Or, if you don't want to repeat the directory names (using root user): sudo -g myUser -u myUser mkdir -p new-1/new-2/new-3
Create nested directories with the same user/group in a single command
1,691,420,788,000
When chaining commands in zsh using ;, && and ||, how can I access the previous command in chain (the command that is being executed before)? Example: rm foo ; echo ... In place of the dots, I'm looking for some kind of command / variable that provides me with rm foo. I have tried playing around a bit with history an...
You could do something like: $ TRAPDEBUG() last_command=$current_command current_command=$ZSH_DEBUG_CMD $ echo test; print -r -- $last_command test echo test Beware there will be some reformatting of the commands: $ (echo test); print -r -- $last_command test ( echo test ) $ (for a (1 2) echo $a); print -r --...
Retrieve last command when Chaining
1,691,420,788,000
I own a 60% keyboard that does not have a ~ key. Before when I was on MacOS, I used to use Karabiner Elements to map Shift+Esc to ~. Now that I've switched to Linux, I would like to know how I can do the same on Linux with just terminal commands.
In X11 xmodmap -e 'keysym Escape = Escape asciitilde Escape' Would map ~ to Shift + any key that is currently mapped to Escape.
Mapping Shift + Escape to ~ From the Command Line
1,627,577,410,000
how to perform a silent install of bandwidthD to avoid windows and put IP and interfaces to monitor by command line (for ubuntu 20.04) sudo apt-get install bandwidthd # with what parameters Important: There is not help bandwidthd. Only help: bandwidthd --help Usage: bandwidthd [OPTION] Options: -D Do not f...
Workaround: sudo DEBIAN_FRONTEND=noninteractive apt-get -y install bandwidthd After installed, if necessary, edit the configuration file and change the default parameters. # default parameters: sudo debconf-show bandwidthd bandwidthd-pgsql/sensorid: bandwidthd/dev: any bandwidthd/promisc: false bandwidthd/met...
how to perform a silent install of bandwidthD in ubuntu 20.04
1,627,577,410,000
Problem I want to parse some data structured as lines (\n separated) with fields separated by the NUL character \0. Many linux commands handle this separator with options such as --zero for find, or -0 for xargs or by defining the separator as \0 for gawk. I didn't manage to understand how to make column interpret NUL...
Is there a way to use \0 as a field/column separator in column ? No, because both implementations of column (that I am aware of), which are the historical BSD and the one in the util-linux package, both use the standard C library's string manipulation functions to parse input lines, and those functions work under th...
Zero/Nul separator breaks column command
1,627,577,410,000
I'd like to create a temporary file that will be read by multiple scripts after its creation, but I don't have an easy way of monitoring when the last script finishes reading this temporary file to delete it (it may be a different script each time). I'd like to know if there's a standard way of solving this problem wi...
Based on taiyu's answer using inotifywait I've created a node.js solution to this problem... It required more details than I expected when I asked it. Sorry if that's not the right place for posting node.js code but the asynchronous nature of the language made things simpler for me... My solution is the following: con...
Is it possible to create a temporary file that will autodelete after a specific time that it's not read by any other program?
1,627,577,410,000
I'm running a command from a bash 4 prompt to gather the output from AWS CLI commands that pull the output of an AWS SSM run document. I can have it output in multiple formats including text or json (default). I am, unsuccessfully so far, attempting put this output into an array so I can loop through the output until ...
You never actually enter the loop: $ completeLoop=false $ while [ ! $completeLoop ]; do date; done; echo complete complete The [ command, when given a single argument (setting aside ! and the trailing ]), will return success if the argument is not empty. Both "true" and "false" are not empty. To act on the actual boo...
Trouble building bash array to validate uptime values from aws cli command json output
1,627,577,410,000
I know, that you can add applications with right click -> Add to favorites. But I want to add / remove the favorites via script. I was trying to use the solution from this question but When executing following command: gsettings get org.gnome.shell favorite-apps I receive following error: No such schema »org.gnome.sh...
I found the solution on my own. The solution was quiet simple.. I executed the command as root, that's the reason why the favorite-apps-list was empty, after executing as my user everything worked as expected.
Locate and add favorite apps Linux Mint 20 via CLI
1,627,577,410,000
I am having to to rewrite history expansion commands, instead of calling it from history. For Example, I have to change 35 to 36, 37, 38.... in the following command. $ print -P '\033[35mThis is the same red as in your solarized palette\033[0m' $ !!:gs/35/36 Now I need to make it !!:gs/36/37 However, when I use the U...
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 ...
View History Expansion On History
1,627,577,410,000
I have the following line in my nginx.conf file: proxy_set_header Authorization "Basic dXNlcjpwYXNzd29yZA=="; Currently, the command to start the nginx is: exec nginx -c /etc/nginx/nginx.conf Is there any way to pass the string "Basic dXNlcjpwYXNzd29yZA==" as argument to the command above, and use the value inside t...
I've written this code: with help from here #!/bin/sh json_file=nginx/auth/basic.json auth_header=$(jq '"Basic " + ("\(.user):\(.pass)" | @base64)' $json_file) basicAuth=$(cat << EOF map "" \$basicAuth {\n\tdefault $auth_header;\n} EOF ) conf_file=nginx/auth/basic.conf echo $basicAuth > $conf_file That converts th...
How to pass argument to file used in nginx command?
1,627,577,410,000
I'm working on a RHEL7 and I just installed clang: sudo yum install clang. Then I execute the command clang-format --version and the output is below: me@localhost:~$ clang-format --version LLVM (http://llvm.org/): LLVM version 3.4.2 Optimized build. Built May 10 2018 (10:48:27). Default target: x86_64-redhat-l...
This issue can be reproduced with older versions of clang-format available for install with yum in sglim2/centos7 docker image for example. clang-format --version has been modified to return 0 in this commit: CommandLine: Exit successfully for -version and -help Tools that use the CommandLine library currently exit ...
Why does `clang-format --version` return 1
1,585,209,776,000
Autojump or z let you move around in your filesystem by entering only a part of the entire path (e.g. z foo takes me to /long/long/path/to/foo). I often want to jump to a path, do something, and get back. This is easily achieved by using cd -. However, if I jump to the path, cd around a little, then want to "get back...
Not sure how I missed this, but z has a -e option that echoes the best match instead of cding to it. I'll give an example of how to use this in fish shell > pushd (z -e ...) You can also use fish abbreviations to abbreviate ze to z -e. I am not sure if there is a way to set an abbreviation to automatically expand to ...
Using autojump / z in combination with pushd popd
1,585,209,776,000
What's the best way to take a segment out of a text file? and the many others in the right sidebar there are almost duplicates. The one difference is that my file was too large to fit in the available RAM+VM and so anything I tried would not only do nothing for minutes till killed, but would bog down the system. One ...
You should try less. From the manpages: Also, less does not have to read the entire input file before starting, so with large input files it starts up faster than text editors like vi (1). I open large files regularly with less and have no problems with the start up time. If you combine it with the option -jn, you ca...
Getting selected lines from a file that is larger than available RAM+VM
1,585,209,776,000
I'm attempting to setup a backup that I want to execute from the command line where, in the case of an error, it curls the error to an API endpoint. Something like: mysqldump -u whatever -pwhatever somedb > somebackupfile.sql || curl (..options..) -d $'{error:<ERROR FROM FIRST COMMAND>}' Any help would be greatly ap...
Save the error stream to a separate file and "curl it" if there is an error. Then delete it (or keep it, it may be useful?): if ! mysqldump -u whatever -pwhatever somedb >somebackupfile.sql 2>error.log then json=$( jq -c -n --arg message "$(cat error.log)" '{ error: $message }' ) curl ...options... -d "$json" ...
mysqldump into file with any error firing off a cURL request with error information
1,585,209,776,000
mohammad@abbasi ~/NGS/Data/RESULTS/TR $ java -jar ~/NGS/programs/Trimmomatic-0.39/trimmomatic-0.39.jar PE DRR000001_1.fastq DRR000001_2.fastq -baseout GgG.fastq HEADCROP:15 LEADING:30 TRAILING:30 MINLEN:50; done -bash: syntax error near unexpected token `done' (base)
Your line ends with ; done, done is the shell syntax to end a loop (for, while, until), but you never start any loop. The shell is confused when it reaches done because it doesn't know what loop to terminate.
I cannot execute trimmomatic on ubuntu
1,585,209,776,000
I'm hoping this is the correct place to ask. Basically, I'm using cmus and have a little bash script to automate downloading, renaming and moving a mp3. However, cmus just lists the song name as its full path in the library (e.g.: /home/user/music/genre/song.mp3) I'd like to change this by adding tags such as album...
Try eyeD3. Install it from python pip. pip installs latest version. Docs here: https://eyed3.readthedocs.io/en/latest/ . eyeD3 has good documentation so it's easy to start. Also it has a bunch of useful plugins - try it!
Adding tags to mp3s for use in music players [duplicate]
1,585,209,776,000
I have a large number of files with the following structure: [Lion] 2015 Africa Book.pdf [Lion] 2015 Africa Magazine.pdf [Lion] 2016 Africa Book.pdf [Lion] 2016 Africa Magazine.pdf [Lion] 2015 Asia Book.pdf [Lion] 2015 Asia Magazine.pdf [Lion] 2016 Asia Book.pdf [Lion] 2016 Asia Magazine.pdf [Tiger] 2016 Africa Book.p...
Try: find . -maxdepth 1 -type f -exec bash -c ' animal=${1%% *}; year=${1#* }; year=${year% *}; mkdir -p "${animal//[][]}/${year/ / - }" && mv "$animal $year"'*' "${animal//[][]}/${year/ / - }/" ' _ {} \; 2> /dev/null result: $ tree . ├── Lion │   ├── 2015 - Africa │   │   ├── [Lion] 2015 Africa Book.p...
Creating directory tree based on file name
1,529,099,354,000
I am getting random "cd: Too many arguments." when using different commands, for example newgrp or when logging in. Here is a console log showing the issue along with the Linux version and shell type. Last login: Mon Jun 4 10:50:58 2018 from somewhere.com cd: Too many arguments. myServerName /home/myUserName> myServe...
The problem was in the ~/.cshrc ~/.login scripts: # ---------------------------------------------------------------------------- # Name : .login # Function : users startup-file for csh and tcsh # ...
Getting random "cd: Too many arguments." error messages when using different commands
1,529,099,354,000
I am trying to find a way to automate the process of merging multi-track .bin + .cue files into a single .bin and .cue. I have a collection of PSX roms, and they all come in bin and cue format. And I am trying to follow the directions here in order to create a "playlist" .m3u file. It recommends merging the multi-tr...
Update: I have published a tool for merging the multi-bin files into a single .bin/.cue pair. You can find it Here Original Answer: For those also looking for a solution. I have come across a python script that seems to work. So far I've tested it with a couple files and it seems to be working. You can find the scr...
Command Line alternative to IsoBuster
1,529,099,354,000
I want to create soft links (ln -s) to folder2 of all the files that contain *foo* in its name, and can be found in some or all the subdirectories of folder1. I've tried it with for, find, and find -exec ln, and a combination of them, but all I get is a broken link named *foo* or a link to everything inside folder1. ...
You can use this little snippet #!/bin/bash folder1="/path/to/folder1" find "$folder1" -type f -name '*foo*' -exec \ sh -c 'for f; do ln -s "$folder1" "/path/to/folder2/${f##*/}"; done' _ {} + This can run from anywhere since I'm using absolute paths here.
Create soft links from multiple specific files in various subdirectories
1,529,099,354,000
Right now I have following command to copy all contents of the current directory to sub-directory, provided if the subdirectory is created in advance: cp -p !($PWD/bakfiles2) bakfiles2/ But I have to some times visit those folders which I have never visited before, so sub-directory "bakfiles2" may not exist there, ca...
cp command doesn't have an option to create destination directory if doesn't exist while coping, but you can achieve with scripting. or simply use rsync command which can create destination directory if doesn't exist only on last level. rsync -rv --exclude='_bak_*/' /path/in/source/ /path/to/destination note that ...
Backup all contents of current directory to a subdirectory inside the current directory, which will be created if not exists
1,529,099,354,000
I have a bash script that runs hostapd_cli all_sta, and the script executes successfully from the command line under both jessie and stretch. The script also works when run under sudo on jessie but not on stretch. On stretch the command times out with the error 'STA-FIRST' command timed out. When I invoke hostapd_c...
The reason this was not working as expected was because /tmp was remapped by systemd to /tmp/systemd-private-67fcab218d3d46bcb5092dd8a6d4789b-nagios-nrpe-server.service-lN2L1e/tmp The issue had nothing to do with sudo but the fact that sudo was executing as a plugin running under the nrpe daemon which in turn was conf...
How can I get hostapd_cli to work under sudo on debian stretch?
1,529,099,354,000
Here are some values I have in a file named "example"--I only put one row but there are about a thousand. a 7 q y 4 5 8 9 5 6 567 5678578 56784 345 345 2 df 4 1 245 b 7 q y 4 5 8 9 5 6 567 5674578 56789 334 324 3 df 4 1 245 Specifically, see in column 1 how the values are a or b...
easy with awk command awk '{print > $1".txt"}' infile.txt this will produce two files "a.txt" containing those lines which column one is only "a" and "b.txt" containing those lines which column one is only "b" if your column one only contains a or b the above is when your data delimited by tab or space, in case it's ...
Selecting rows with specific value in column
1,529,099,354,000
After running the following command to revoke a key gpg --gen-revoke <key ID> I have to then press y, 2 times Enter followed by y How would you suggest to answer automatically, that is revoking a key without any other user interaction than the passphrase prompt?
It appears to me that gpg opens the controlling terminal directly, so you're unable to redirect input.
How to revoke a GPG key without confirmation?
1,529,099,354,000
I have the dir var/www/html and under it there are a few website dirs (say, about 5). All of the 5 website dirs have an internal path dir0/dir1. How could I bulk delete all inodes inside this path (besides one inode named he_IL.mo), but in one command? I ask about one command since I have the following block of 3 comm...
The way to use one command is removing the -type, from the command. Then we get: find /var/www/html/*/dir0/dir1/ ! -name 'he_IL.mo' -exec rm -f {} + Note that it won't will delete directories and softlinks with the name he_IL.mo as well, but if it's okay, use it.
Delete all inodes BESIDES one UNDER all instances of dir0/dir1 UNDER var/www/html, in one command
1,529,099,354,000
I have a file named users.json which is 3GB, and is invalid json. So what I'm trying to do is read the file's text content, and take the information that I need, which is the usernames contained in the file, and write them to a usernames.txt file which should contain 1 username per line, with no duplicates. The format...
You can use the grep command to match the patterns you need, and sort to filter out duplicates. If your input file is input.json and the output is usernames.txt: grep -P -o '(?<="username":")[^"]*' input.json | sort -u > usernames.txt Breaking it down: grep is a command-line utility for matching regular expressions ...
Generate .txt file with specific content from an invalid 3GB .json file
1,529,099,354,000
I have Installed CentOS 7 x86_64 and I forgotten root password. After then I reset the password editing boot grub menu according How To Reset Root Password On CentOS 7 as follow. But after rebooting machine now I have no GUI or CLI login. What should I do ? 1 – In the boot grub menu select option to edit. 2 – Select O...
Use theses steps to solve your issue. Interrupt the boot loader countdown by pressing any key. Move the cursor to the entry that needs to be booted. Press e to edit the selected entry. Move the cursor to the kernel command line (the line that starts with linux16). Append rd.break (this will break just before control...
CentOS 7 GUI or CLI not loading
1,477,679,498,000
I have an xml document containing an element witch I can select with stkconfig>Video[width]. So, I want to modify the value of this element. There is a CLI utilities for this?
Finally I find XML Starlet as suggested by Sato. I use for that xmlstarlet ed --inplace -u "/stkconfig/Video/@width" -v <new value> <path to my document.
Modify xml uttribut value of an xml document by selector
1,477,679,498,000
I have a script which function like this for one file. ./script 0001g.log > output for two or more files, like this ./script 0001g.log 0002g.log 0003g.log > output The script take one special number from each input file and put it in one output file. My question is I have 1000 input files, how can I do a loop to exe...
You have a few possible solutions: Simply $ ./script *g.log >output ... and hope that *g.log doesn't expand to something that makes the command line too long. This is not very robust. If your script doesn't depend on the number of files given to it, i.e., if output can just be appended to output for each input file, ...
How to do a loop to execute many files
1,477,679,498,000
I am writing a script that will systematically install Numix theme using gnome-tweak-tool. I want to make sure that I don't reinstall items if they are already installed, so I used which [name of item] > /dev/null. Here is my current script: function installNumix() { echo "Checking if Numix is installed ..." ...
Instead of getting the user to manually use gnome-tweak-tool, you can set the gtk and window-manager themes and the icon-theme in your script with gsettings. e.g. gsettings set org.gnome.desktop.interface gtk-theme Numix gsettings set org.gnome.desktop.wm.preferences theme Numix gsettings set org.gnome.desktop.inter...
How would I make this script more efficient? [closed]
1,477,679,498,000
I installed Raspbian to a 16 GB card and expanded the filesystem. When I made a dd backup of the card, the .img file output was ~16 GB. Most of it is unused space in the ext4 partition—I'm only using like 2.5 GB in that partition. (There are two partitions—the first is FAT for boot and the second is ext4 for rootfs.) ...
I can confirm you are in the right track shrinking that filesystem; fdisk/parted is next. The tricky part is getting it right next to the size of the new filesystem,do your math or leak a hundred KB more just to be safe. You can adjust it later on the new card if need be. The order is normally: umount, resize, fdisk/p...
Shrinking Raspberry Pi SD .img via Ubuntu Server (cli)
1,477,679,498,000
I have thousands of PDF files named in the format Author Year Title of the book The first two spaces are relevant: they make a break between the Author, the year and the title. The title could contain a number of space. I am looking for a script to write the author to the author meta field in the PDF; the Title to t...
Some EXIF manipulation tools have a built-in way to rename files based on EXIF data, but I don't know of one that can do it the other way round. So let the shell call the program with the right parts of the file names. Here's a script that processes just one file (pass the name as the sole argument of the script). #!/...
Write PDF metadata from the file name using Exiftool or PDFtk
1,477,679,498,000
What's going to happen if I shutdown my PC after suspending a terminal process (with Ctrl+Z)? In my case, it's sudo apt-get upgrade. The upgrade file size is 250 MB, it takes far more time downloading those files compared to downloading some random files with the same size from websites. So, will I lose all my downloa...
If you shut down your computer, it starts again with no program running. Depending on your desktop environment, some of the programs you were using may be started automatically when you log in again, and if the programs remember their open files then they'll have the same files open, but that's about it. Many GUI appl...
Shutdown PC after suspending terminal process (apt-get upgrade)