New answers tagged

0 votes

Screenshot using the terminal command

In recent versions, the gnome-screenshot tool remains available for installation in current Ubuntu versions. It works correctly with Wayland.
vanadium's user avatar
  • 87.9k
0 votes

Terminal not opening on Ubuntu 22.04 on Virtual box 7.0.0

This worked for my Virtualbox 7.0 with host Windows 10 and guest Ubuntu 22.04. Start Virtualbox machine and press Shift quickly until the grub boot menu is shown. Go to Advanced options for Ubuntu ...
Katu's user avatar
  • 3,583
0 votes

How do I make Ctrl-arrow skip over dots and dashes

You can try the following actions: shell-forward-word (M-C-f) Move forward to the end of the next word. Words are delimited by non-quoted shell metacharacters. shell-backward-word (M-C-b) Move back ...
muru's user avatar
  • 198k
1 vote

Screenshot using the terminal command

"In all ubuntu versions" is the tricky part here. In older releases you could use gnome-screenshot to do this. But more recent releases of Ubuntu don't have that binary, as the screenshot ...
popey's user avatar
  • 23.6k
0 votes

How can I quit when connected via telnet?

For me I've tried holding Control and tried everything from 1 to 0. I found out that Control+5 worked for me. It took me back to the main telnet prompt and from here you can leave like @Oli mentioned ...
David Le's user avatar
0 votes

How to remove special 'M-BM-' character with sed

A easy solution was offered in https://stackoverflow.com/a/36371440/906489 by Jens tr -d '\200-\377' m.txt > m-no-8bit.txt That removes all values from 128 to 255, which is octal 200 to 377 (which ...
ahyee2Oo's user avatar
1 vote

How to get gzip operating recursively at all depths?

Not an exact answer to your question, but you can use xargs for that, which allows you to run multiple gzip processes in parallel, like find -name '*.vtk' -print0 | xargs -r0n1 -P$(nproc) gzip look ...
Simon Richter's user avatar
2 votes

How to get gzip operating recursively at all depths?

After the answer by terdon, and upon tinkering a bit, I came to the conclusion that the way -r works is the following: If what is matched is a file (only in the present directory) do gzip. If what is ...
sancho.s ReinstateMonicaCellio's user avatar
8 votes
Accepted

How to get gzip operating recursively at all depths?

No, gzip can't do this, -r just means "descend into subdirectories" but there is no option for "descend into subdirectories and then look for files matching this glob". The ...
terdon's user avatar
  • 101k
0 votes

wget to download files from list of urls and naming it from other list of names

You can use this script: #!/bin/bash # URLs.txt # NAMEs.txt count=1 while read URL; do NAME=$(sed "${count}q;d" NAMEs.txt) wget -O $NAME $URL count=$((count+1)) done <URLs.txt
John Paul Qiang Chen's user avatar
0 votes
Accepted

Running an app under specific locale "formats"

Is there a way to run an app under specific locale and formats (en_US and en_GB respectively) for testing purposes, without affecting system-wise settings? Yes, you can set environment variables on ...
Raffa's user avatar
  • 32.1k
2 votes
Accepted

Scheduled a computer to reboot everyday at 7AM, not sure if I did it correctly

Your, cronjob and logic is correct syntax-wise and you can verify if you succeeded in installing the new crontab for your user with: crontab -l ... and you should see your added cronjob listed in the ...
Raffa's user avatar
  • 32.1k
0 votes

Open Microsoft Edge in Ubuntu

Assuming that you install the .deb package from https://www.microsoft.com/en-us/edge, you can use the following command the start MS Edge directly and load the page you want: $ /opt/microsoft/msedge/...
FedKad's user avatar
  • 10.5k
0 votes
Accepted

caret character unexpected behaviour in regular expressions with grep

My intention is to find the keywords starting with "zip" The caret ^ matches the beginning of a line and not the beginning of a word ... Therefore, grep '^zip' dirlist*.txt will only match ...
Raffa's user avatar
  • 32.1k
1 vote
Accepted

changing grep command --color from red to another color

The simple solution: Add --color=always to the grep options... then pipe the result into | sed -re 's/31m/32m/' and you will get green text instead of the red. Another way is described in the man page:...
Hannu's user avatar
  • 5,374
0 votes

RPM Euro Games keyboard backlight not working in ubuntu 20.04

Hey if you are still facing the issue try running the below command in you terminal, it worked for me. sudo xmodmap -e 'add mod3 = Scroll_Lock
pydi's user avatar
  • 1
0 votes

Open Microsoft Edge in Ubuntu

The Edge browser from windows is not the one you use in Ubuntu. Download the DEB, install it through software center and it will be available as a suggested browser.
Rinzwind's user avatar
  • 299k
0 votes

How to write a bash script from two commands (Find and replace a text string in all files recursively in current directory)

This site is not a script-writing site, but help to anyone on planet Earth is a strong motive in this community (no discrimination against beings from other planets :-) thogh). That said, take the ...
Raffa's user avatar
  • 32.1k
0 votes
Accepted

Intermittent lag in command terminal?

welcome to the forum. System Resources This seems like a hunt to find which system resource is insufficient but we can't tell because there is not enough information. You could provide details like: ...
musicman1979's user avatar
  • 1,139
2 votes
Accepted

I followed a solution procedure on AskUbuntu, logged out and now all my data is gone (no guest account)

Problem User home directory and everything in it were deleted Explanation: The command rm -rf ~ performs the following actions: rm: This is the command used to remove files or directories in Unix-...
musicman1979's user avatar
  • 1,139
2 votes
Accepted

What are zsh equivalent to bash's shopt -s globstar and shopt -s dotglob?

Recursive globbing is the default in zsh, it doesn't need to be enabled. The ** glob is simply syntactic sugar here: A pathname component of the form ‘(foo/)#’ matches a path consisting of zero or ...
muru's user avatar
  • 198k
1 vote

Copy a folder name into the name of its files

In a Bash shell loop with mv: for f in */*; do if [ "${f%/*}" != "Pictures" ]; then echo mv -nv -- "$f" "Pictures/${f%/*}${f#*/}" fi done You'll ...
Raffa's user avatar
  • 32.1k
0 votes
Accepted

Invoke a program as a command on any working directory on ubuntu's terminal

Copy your program into your $HOME/bin directory. Next login your $PATH should contain your bin dir, so the program should work as you described.
ubfan1's user avatar
  • 17.8k
3 votes

Copy a folder name into the name of its files

If both directories are located in the same parent directory, in Desktop as an example, you can use something like: cd ~/Desktop rename -n 's,^(.*)/,Pictures/$1-,' Mexico/*.jpg Spain/*.jpg Note that ...
muru's user avatar
  • 198k
0 votes

Copy a folder name into the name of its files

The following script should work. for file in $(find "./$1" -type f); do cp $file "./Pictures/$1$(basename $file)" done It goes through the files in the $1 (argument 1) ...
Frosty126's user avatar
1 vote

Changing Linux file names to NTFS-compatible file names

With Perl's rename: rename -n 'y/\\: /__\-/ if -f' * ... where -n is for a dry-run (to actually rename files, remove it or change it to -v for verbosity), y will translate each character in the ...
Raffa's user avatar
  • 32.1k
0 votes

Changing Linux file names to NTFS-compatible file names

Create a script, e.g. translate.sh: #! /bin/bash old=$1 new=${1//:/_} # Replace colons by underscores. new=${new// /-} # Replace spaces by dashes. new=${new//\\/_} # Replace backslashes by ...
choroba's user avatar
  • 9,628
0 votes

Switching Plasma theme from the command line

kwriteconfig5 seems to be an actual answer. But there is no documentation on the Internet. For example, to switch to the default Breeze theme the command is: kwriteconfig5 --file kdeglobals --group ...
okoloBasii's user avatar
2 votes

How to stop wget command?

Kill the wget command by using pkill, and sending the TERM signal (default for the command): pkill -x wget If this doesn't work, send the KILL signal instead: pkill -9 -x wget
Artur Meinild's user avatar
0 votes

How to exit gpick color picker after picking from a keyboard shortcut?

To pick single color and output use: gpick --pick --single --output or: gpick -pso
Yukulélé's user avatar
0 votes
Accepted

Database not saving imported sql file in terminal MySQL

It turns out the sql file that I imported had a USE query. I was just supposed to use the database that were set in the sql file, or delete the USE query in said sql file. Thank you @glenn jackmann ...
NuhUh's user avatar
  • 1
0 votes

How do I select a field/column from the output of `ls -l`?

I need to catalog my installed applications prior to backing up and upgrading and encountered this issue trying to figure out how to trim ls output, but the awk applications suggested in other Ask ...
haleba's user avatar
  • 1
-1 votes

Home directory not being created

My issue was that SELinux was preventing creation of home directory upon login by an unprivileged user: $ ls -ldZ /home/ drwxr-xr-x. root root system_u:object_r:root_t:s0 /home/ That root_t was ...
tash's user avatar
  • 107
3 votes

How to fix "chmod" permissions after running "chmod 222 /bin/chmod"?

You can execute a file that lacks execute permission simply by calling its interpreter. Here's a very simple example: $ touch file $ stat -c '%a' file 664 $ echo 'echo hello' > file $ ./file bash: ....
Zanna's user avatar
  • 70.4k
4 votes

Cut folder names out of string

Oh okay, here is a sed answer $ echo 'TRUE|/home/linux/test|(null)|' | sed -r 's#.*/([^|]+)\|.*#\1#' test Explanation: -r use extended regex s#...#..# find and replace using # as an alternative ...
Zanna's user avatar
  • 70.4k
0 votes

Not able to update or upgrade after upgrading from Python 3.10.12 to Python 3.11

You can try using re-installing the gnome-terminal. First, you'd like to take a back of the gnome setting if you configured it well. Here - https://askubuntu.com/a/1056392/1774643 Second, re-install ...
Tushar B's user avatar
3 votes

Cut folder names out of string

It's not really clear from your question if you want to get the third item of an absolute path or if you want to get the last item of an absolute path. If you want to get the third item of an ...
BeastOfCaerbannog's user avatar
11 votes

Cut folder names out of string

There are already two working solutions here, but I just wanted to also point out the following method, which maybe maps onto the imperative mindset more. echo 'TRUE|/home/linux/test|(null)|' | awk -F ...
Pacopenguin's user avatar
13 votes

Cut folder names out of string

Bash has a very easy way to match elements of a path (as long as your path is defined as a variable) with parameter expansion. Using the ${parameter##word} construct, you search from the beginning of ...
Artur Meinild's user avatar
0 votes

accidentally moved almost all my files in a new directory, is it the end for me?

The mv command doesn't keep a record of file movements, and the metadata of the moved files will not contain a history of last locations. I think your best option now will be to write some scripts to ...
Javier's user avatar
  • 1
8 votes
Accepted

Cut folder names out of string

If you would like to get "Extra credit" for your assignment, Then use awk echo 'TRUE|/home/linux/test|(null)|' | awk -F '[|/]' '{print $5}' The awk option -F defines the field separator(s). ...
stumblebee's user avatar
  • 3,537
0 votes

Login for Terminal

On my side, it's revesed. Ctrl + Alt + F1 turns me back to graphical session. Ctrl + Alt + F3 takes me to the terminal session.
Mahir Alp Taşkın's user avatar
0 votes

How do I determine the total size of a directory (folder) from the command line?

One can use 7z (sudo apt-get install p7zip-full) to determine the total apparent size of a directory from the command line. Example: 7z -mx=0 a temp16584.zip /path/to/directory It will show the total ...
Franck Dernoncourt's user avatar
2 votes

How to fix unresponsive Terminal

‘.bashrc’ is executed when you start a Terminal session so, yes, that is a probable cause. You’ve likely added something in there which is not finishing and the Terminal session is waiting for it to ...
Rich Sedman's user avatar
0 votes

How do I rerun the second-to-last command?

On top of using Ctrl-R <term> or !-2 to re-run an old command, you can also view your command history and run it by index as well. Say your history looks like: ... 1770 ls 1771 ...
TankorSmash's user avatar
0 votes

How do I open Ubuntu Software Center via Terminal?

For Ubuntu 22.04.3 use the command snap-store In case it does not load try this: killall snap-store sudo snap refresh source: Ubuntu software does not load in Ubuntu 22.04.3 LTS
akpp's user avatar
  • 141
1 vote

Bash script using eyeD3 to remove extra tags from mp3 files

The error is from mawk, which is the default implementation of awk in Ubuntu. Sometime between Ubuntu 18.04 and Ubuntu 20.04, this was fixed so that mawk would work fine with the FS as give ():): % ...
muru's user avatar
  • 198k
0 votes

Arrow keys, Home, End, tab-complete keys not working in shell

I believe it depends on the terminal and the environment the terminal operates in. There are various issue sources which may affect the case. However, in Konsole terminal connected through SSH to a ...
Artfaith's user avatar
  • 219
0 votes

How to completely restart script from inside the script itself

Late & noob, but I had to use absolute path to make mine work: exec "/usr/local/bin/audio-device-switch.sh" (exec "$ScriptLoc" didn't work for me)
taps's user avatar
  • 1
0 votes
Accepted

Custom alias to run and compile .c file

I don't think you can include a variable within an alias. And in any case, you cannot use a variable within single quotes, you'd have to use doublequotes instead. This function should work. Place ...
mchid's user avatar
  • 43.5k

Top 50 recent answers are included