command-line

Mounting a Disk Image

Mounting a Disk Image I’m trying to create a disk image and mount the partition for further work, but I’m encountering a frustrating error message: "wrong fs type, bad option, bad superblock." Here’s the steps I took and the output I received: $ dd if=/dev/zero of=test.img status=progress bs=200M count=1 1+0 records in 1+0 records out …

Total answers: 2

Is it possible to sort the letters in a word in a line of text?

Is it possible to sort the letters in a word in a line of text? So I have a file full of test commands that I like to run against some of my functions to make sure they are handling all possible situations correctly. No point in having duplicate commands tho. Here’s some examples: rap …

Total answers: 5

What are the file size options for "find . -size" command?

What are the file size options for "find . -size" command? I found out that to look for file size in bytes, I use ‘c’. So I can look for file size with 1000 bytes by using: find . -size 1000c But what about different kind of size such as Mb, Gb or even bits? …

Total answers: 3

How to get display to show a pdf properly

How to get display to show a pdf properly When I do: display file.pdf it shows this: I can’t resize the little window that it adds but I can remove it by clicking on the x. I can also remove the checkerboard effect that comes from assuming transparency, I think, with: display -alpha opaque file.pdf …

Total answers: 1

Fixing title of xterm even during editing a file inside it

Fixing title of xterm even during editing a file inside it To write a document I need to put a picture that I can capture from the screen. The picture is supposed to have an xterm which displayout uart output during rtl simulation. But I didn’t capture it when I did the simulation and it …

Total answers: 1

How to place my own code snippets on command line à la history?

How to place my own code snippets on command line à la history? I have hundreds of tested and tried commands and snipets saved in various text files. When I need to re-use one, I find and copy/paste to the command line. Though reliable this is a clumsy method. Compare this to the elegant way …

Total answers: 3

How to replace a file path with whitespace using sed?

How to replace a file path with whitespace using sed? I have many different files with a string in them. I need to replace this string with a path, although the path contains whitespace. So far, I have this: for a in files_[a-z][a-z]_all.conf ; do fileWithPath="~/Downloads/files_config_linux/auth-user-pass files_userpass.txt" otherOne="auth-user-pass mullvad_userpass.txt" sed -i ‘s|’$otherOne’|’$fileWithPath’|g’ $a done But …

Total answers: 2

input delay on Terminal Ubuntu 22.04.4

input delay on Terminal Ubuntu 22.04.4 I have been using Ubuntu since Christmas, and just recently I have been receiving delayed input while using the Ubuntu terminal. It especially takes affect when using vim or man commands, which is strange as no other software I have has no delay when typing even UTerm and UXTerm …

Total answers: 5

manipulate ls text output to add path to filenames

manipulate ls text output to add path to filenames I get sometimes files with following ls output format: /etc/cron.d: -rw-r–r– 1 root root 128 May 15 2020 0hourly -rw——- 1 root root 235 Dec 17 2020 sysstat /etc/cron.daily: -rw——- 1 root root 235 Dec 17 2020 sysstat Is there any chance using normal gnu tools …

Total answers: 6

Where do I find documentation for the output of ls -l?

Where do I find documentation for the output of ls -l? There have been multiple questions asked about this, like Understanding ls output, What are columns in ls -la?, What does ‘ls -la’ do?, What do the fields in ls -al output mean?, etc.. I’ve also come across many other websites with articles attempting to …

Total answers: 2

How to get gzip operating recursively at all depths?

How to get gzip operating recursively at all depths? I mean to gzip all files *.vtu, at all depths below a given directory, in bash. I have such files at depths 1 and 2 below ./. I managed to do so with $ gzip -v $(find . -name "*.vtu") I could also use find … …

Total answers: 3

Running an app under specific locale "formats"

Running an app under specific locale "formats" I know you can use export LANG=xx_XX.UTF8 to run a program under specific locale, but regional settings in Linux/Ubuntu also feature "Formats" option. 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? Follow-up …

Total answers: 1

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

Scheduled a computer to reboot everyday at 7AM, not sure if I did it correctly Running Ubuntu 20.04, I have computers that I want to reboot everyday at 7AM. I followed these instructions, and I thought it was working, but now when I use the uptime command, it will often report longer than 24 hours, …

Total answers: 1

changing grep command –color from red to another color

changing grep command –color from red to another color I’m searching from the file using grep command with particular pattern, sysadmin@localhost:~$ grep bash /etc/passwd which return the output like below root:x:0:0:root:/root:/bin/bash operator:x:1000:37::/root:/bin/bash sysadmin:x:1001:1001:System Administrator,,,,:/home/sysadmin:/bin/bash How can I change the default color of red to something different (eg.blue) Asked By: SpiderMan || Source The simple solution: …

Total answers: 1

caret character unexpected behaviour in regular expressions with grep

caret character unexpected behaviour in regular expressions with grep i was running grep commands from "William Shotts" regular expressions example.It seems,the caret character is not doing what it is supposed to do. I have four test files with all the bin entries in text form.My intention is to find the keywords starting with "zip" from …

Total answers: 1

Intermittent lag in command terminal?

Intermittent lag in command terminal? I have a workstation that we run numerical simulations on using in-house code, submitting jobs from the command line and using vim to edit/view files. My problem is that whenever we are running at least one job (not even up to full capacity of CPUs available), we see intermittent lag …

Total answers: 1

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

What are zsh equivalent to bash's shopt -s globstar and shopt -s dotglob? I need zsh equivalent to bash‘s shopt -s globstar and shopt -s dotglob. How can I do that? UPDATE 01: As per @muru’s answer, I used setopt globdots in the zsh shell, and ran the following command: for i in INSTALL_USER_FILES/** ; …

Total answers: 1

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

Invoke a program as a command on any working directory on ubuntu's terminal I have written a program in C and produced an executable from it. I want to use this program from any pwd. One method is to make its pathname a environment variable using export. But in this method, everytime I want to …

Total answers: 1