New answers tagged

0

While you run your code in visual studio code type sudo before the program path. In the vs code studio terminal. It will ask for password and will run enter image description here


0

To change the terminal language to English permanently, use: echo 'export LANG=C' >> ~/.bashrc && exec bash


3

tree # Also output directories but not hidden files . ├── Directory1 ├── Directory2 ├── File1 └── File2 tree -a # Also output hidden files and hidden directories . ├── Directory1 ├── Directory2 ├── File1 ├── File2 ├── .Hidden_Directory1 ├── .Hidden_Directory2 ├── .Hidden_File1 └── .Hidden_File2 find -type f # Files and hidden files ./File1 ./File2 ./....


1

Eventually, running sudo apt remove mysql-server-8.0 solved the problem and sudo apt autoremove finished without any error messages.


2

You can use aliases to prevent those commands from execution. for example for preventing command git from execution you can append this line to the file /root/.bashrc: alias git='echo You are root!'


1

You can try to use rhash. http://rhash.sourceforge.net/ https://github.com/rhash/RHash http://manpages.ubuntu.com/manpages/bionic/man1/rhash.1.html Test: $ sudo apt-get install rhash $ echo -n 123456789 | rhash --simple - cbf43926 (stdin)


0

it's so simple, just press F11 in your keyboard. F11


4

Ubuntu does not have a root user so I am assuming that you are using sudo su. There are very few situations where this is needed. It's better that you learn to use sudo effectively only when superuser access is actually needed. When you are using sudo su, everything you run is as if you were using the root user. By definition, the root user can do anything ...


0

This answer given at superuser worked for me, I did not get other answers on this question working within 2 minutes. Credits go to goyinux for the original answer. gs \ -sOutputFile=output.pdf \ -sDEVICE=pdfwrite \ -sColorConversionStrategy=Gray \ -dProcessColorModel=/DeviceGray \ -dCompatibilityLevel=1.4 \ -dNOPAUSE \ -dBATCH \ input.pdf


0

I think you need to use the commands sort and comm for this job. For example: comm -23 <(sort -u file1.txt) <(sort -u file2.txt) > file3.txt I will leave it to you to play with the suppression flags (-1,-2,-3) for the desired outcome. I have used -23 as an example. Another perhaps easier method is using awk as follows: awk 'FNR==NR{lines[$0]=1;next}...


0

Try this command git branch --show-current


0

From cp --help: cp [OPTION]... SOURCE... DIRECTORY The SOURCE... with three commas means multiple params i.e. you can just make cd your_source_dir cp file1 file2 dest_dir


0

pkill -9 -f jboss || true or pkill -9 -f tomcat || true


1

Edit: I've created a small setup script that creates all the three files and puts them in the right places. Just download the script and execute it in a terminal: sh pulseaudio-equalizer-setup.sh If you only need/want the sound equalizer running while the equalizer GUI is open, I created a minimal working solution with these files: ~/.config/pulse/default....


0

The simplest usage is to set the SSHPASS variable: read -p "SSH password:" SSHPASS export SSHPASS Then you can run e.g.: sshpass -e ssh $user@$host echo Test If something is going wrong, the -v flag will give you more information.


0

New and easiest way Configure your default integrated terminal by running the Terminal: Select Default Profile command, which is also accessible via the terminal dropdown. https://code.visualstudio.com/docs/editor/integrated-terminal#_terminal-profiles


0

I want to thank both @vanadium and @pLumo for their answers, which were very helpful, but both of used utilities have their own disadvantages and bugs at least on my system, so I finally went with combination of two approaches #!/bin/bash OUT_FILENAME=Screenshot from $(date "+%Y-%m-%d-%H-%M-%S").png OUT_PATH=~/Pictures/$OUT_FILENAME gnome-...


0

Just rebooting can fix it, but it depends on what caused the change. Before you fiddle with settings, reboot and see if the resolution reverts to the correct setting.


3

Correct, if the answer section is missing, there is no record on that subdomain/DNS entry you are looking up, e.g _dmarc.domain.com If I were to do checks for myself, I would probably just check if the command outputs v=DMARC1, like: dig TXT _dmarc.domain.com | grep v=DMARC1 However, this does not mean that the DMARC is valid. Dig does not check this in ...


1

I know this is a quite old question. service command worked for me. To stop the service - service bluetooth stop To start the service - service bluetooth start


0

Maybe to late. If I understand correctly, what you met is not a terminal. In this Ubuntu version, if you didn't switch, the tty2 should hold your running one, but tty7 is nothing. This is because the default display manager of 18.04 is SDDM, which just have 6 initial ttys(tty1~tty6). So, if you did something like Ctrl+Alt+F7, the traditional place of a GUI ...


10

Single or double quotes will not cause any problems as long as you keep the variables properly quoted at all times. $ title=$(cat << END_TITLE This "is a title" with 'two kinds of quotes' END_TITLE ) $ declare -p title declare -- title="This \"is a title\" with 'two kinds of quotes'" $ mkdir "$title" # no ...


1

for the completeness: you may also use -delete find /some/where/ -name '*.log' -type f -mtime +7 -delete


1

Since your preferred shell is Fish, I'll offer three options. First, given the DataList in a string format, you can use string split to split the individual lines into an actual list: > set DataList " Cat Dog Rabbit GuineaPig Hamster " > set --show DataList $DataList: set in global scope, unexported, with 1 elements $DataList[1]:...


0

deepin-terminal is a pretty good option, very fast/light terminal


0

I think the swap of your server is used up. Run these commands to clear RAM cache and SWAP sync; echo 1 > /proc/sys/vm/drop_caches; echo 2 > /proc/sys/vm/drop_caches echo 1 > /proc/sys/vm/drop_caches && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared' More information: Clear PageCache only: sync; ...


0

I'd keep the values in a colon-separated list, and use Stephen Collyer's "Bash Path Functions" and cut -d: -f3 or similar. Here's my pre-written blob: I use Stephen Collyer's bash_path_funcs, described in Linux Journal way back in 2000: https://www.linuxjournal.com/article/3645 https://www.linuxjournal.com/article/3768 https://www.linuxjournal.com/...


3

Not sure of what you Need. does this help? #!/bin/bash DataList=( Cat Dog Rabbit GuineaPig Hamster ) for i in {0..4} do value[$i]=${DataList[$i]} echo "value[$i] = ${value[$i]}" done outputs: value[0] = Cat value[1] = Dog value[2] = Rabbit value[3] = GuineaPig value[4] = Hamster


0

"even though there are 2 possibilities" Different shells behave differently, but the default bash shell in Ubuntu will not tab complete all the way to the end of the path if there are multiple paths that match what you've typed so far. It will only complete what is unique to what you've typed so far and stop when there are multiple files that ...


1

You can use python with mechanize and http.cookiejar, e.g.: #!/usr/bin/env python3 import mechanize import http.cookiejar cj = http.cookiejar.CookieJar() br = mechanize.Browser() br.set_cookiejar(self.cj) br.open("http://www.example.com/") br.select_form(id="loginform") br.form["username"] = "myuser" br.form["...


0

Finally reconstructed how to do make it calculate accurately. And yes, it did involve using 'scale'. BYTECOUNT=$(echo "scale=0; (( $BYTECOUNT / 1073741824 )) " | bc ) The above worked (with BYTECOUNT previously set to the grossly large initial number). Odd that scale=0 is necessary since I believe that is supposed to be the default, but it does ...


0

I guess your first option works fine, but screen will run in detached mode, so you'll see no output outside screen. Check screen -ls to see running screen sessions and screen -r ID to attach to them. Anyways, you could better use absolute paths: /bot/bot.sh instead of cd /bot/ && ./bot.sh: #!/bin/sh screen -S Bot -d -m /bot/bot.sh You should be able ...


1

This script is based on a number of presumptions: I'm using tmux instead of screen The script you want to run inside tmux is /bot/bot.sh So the ./script.sh I would suggest is the following: #!/bin/sh sessname="Bot" # Create a new session named "$sessname" tmux new-session -d -s "$sessname" # Run command in the session "...


1

It depends on what login mechanism the website uses, because there is no standard. Most websites today use cookies. So basically you have to automatically fill in the login form, submit it, and store the cookie you get in return. Then you have to use that cookie in subsequent access to the site. curl is a good tool for this. You have to write a script where ...


1

Assuming you use the default Ubuntu desktop, just combine two options of the gnome-screenshot command for sending to the clipboard and to a file: gnome-screenshot -c -f file.png This will send the output to the clipboard and to a file, in this example in your Pictures folder, named according to the timestamp given by the date -Ins command.


1

You can just add the xclip command to scrot -e: scrot '%F_%T.png' -e 'xclip -selection clip -t image/png "$f"; mv "$f" ~/Desktop/' Of course you don't need to move the file to the Desktop, it's just an example how to combine multiple commands ... You might need to install scrot: sudo apt install scrot


2

In my case, -auth=ID:PASS didn't work. So I used this: lynx -cmd_log=/home/luk/lynxScript.lys -accept_all_cookies www.webside.com/auth Then logged in, with a password. As a result (save in the file lynxScript.lys), I got all the commands executed when logging in. Now I could use this: lynx -cmd_script=/home/luk/lynxScript.lys -accept_all_cookies www.webside....


1

Bash integers are not arbitrary precision: Evaluation is done in fixed-width integers with no check for overflow, though division by 0 is trapped and flagged as an error. A likely upper limit in modern systems would be 2^63 for signed integers: $ echo $(( 2**63 - 1 )) 9223372036854775807 $ echo $(( 2**63 )) -9223372036854775808 $ echo $(( 2**62 )) ...


1

It can be done with grep only grep -f file1 file2 grep -f file2 file1


0

I find it best to use dc for this: V=$(echo "8 k 41003021288998461440 1073741824 / p" | dc) echo $V This sets the precision to 8, divides the next two values and then pops it off the stack.


0

I'm assuming the second example (p1.sh file2 file1) should output cc as there is no line with just c in file1. If so, then: #!/bin/bash cat "$1" | while read m do grep "$m" "$2" done | sort -u example: $ cat f1 a b bb b cc $ cat f2 aa ab bc c $ ./p1.sh f1 f2 aa ab bc $ ./p1.sh f2 f1 cc


1

After some more deeper analysis I found good and interesting desktop-files for "Wine Windows Program Loader" which came from Wine packages. It has special options in Exec field: Exec=wine start /unix %f and forces exe-file to be launched in its directory. For my case it may be adapted for ~/.local/share/applications/wine32.desktop as shown below: ...


1

For the Desktop entries there is a Path parameter available. Here is how the StarCraft II launcher (created during the installation by Wine) looks like: [Desktop Entry] Name=StarCraft II Exec=env WINEPREFIX="/home/spas/.wine" /opt/wine-staging/bin/wine C:\\\\windows\\\\command\\\\start.exe /Unix /home/spas/.wine/dosdevices/c:/users/Public/Desktop/...


0

According to gsettings, this should do the trick: gsettings set org.gnome.desktop.session idle-delay 0


0

You can use torrent-dl It was originally based off of tget, a tool mentioned in this answer, but the project has since significantly diverted from it. tget does not offer any configurability (e.g. searching popular torrent sites, customizing what port to use, downloading multiple torrents, etc) so torrent-dl adds all of these features. Example usage (with ...


1

Use ~/.profile. It's sourced by the display manager and alters PATH for the whole session.


2

According this support topic How to Use dig/nslookup to Find SPF, DKIM and DMARC Records for a Domain? from CISCO, the syntax to use dig to look up DMARC status is: dig _dmarc.domain txt Substitute domain with the domain you want to look up.


1

The quickest way to the solution is to install the build-essential meta-package. sudo apt install build-essential


0

My guess would be that in the working example the "killall" will return very quickly on each node, while in the non-working example the pwomxplayer on the first node never returns, so it doesn't even start the one on the second. Have a look at the man page of ssh, and in particular at the "-f" parameter that'll force it to go into ...


1

Every *.desktop file has Exec= field. This field may include: executable name which is already in $PATH; full path to executable which is not in $PATH; full path to user/system-created script which does what is needed. Documentation to read: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables . ...


Top 50 recent answers are included