Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
0 answers
56 views

How to detox filenames in a bash script with no errors posted?

OS: Kubuntu 22.04.4 LTS x86_64 detox 1.4.5 To display above: neofetch --stdout |grep 'OS:' detox -V Here is a toxic filename, starts with s1: s1 Ä Ö Ü - ä ö ü Science & < > " 1 \ 2 ⁄ 3 ...
joseph22's user avatar
  • 367
0 votes
1 answer
236 views

Broken pipe, write error: An epidemic of unnecessary output

In the last few months, a problem has been spreading across my systems. That of broken pipe errors: # Solution: # silenced by replacing /bin/bzip2 -> bzip2-reference # to /bin/...
Hincor's user avatar
  • 1
2 votes
1 answer
51 views

How can I use the last changed file as an argument in linux?

I'm thinking of using the last changed file as an argument to commands like ls, echo, or cat, is there a simple and efficient way? this question arose when I was faced with analyzing the latest log ...
Ilgar's user avatar
  • 21
0 votes
3 answers
71 views

display path to files with same names

with this command in Terminal: ls -R |sort | uniq -d | sort -r I can display a list of files with the same names located in the running directory and subdirectories. But I would like to display also ...
all2alb's user avatar
0 votes
0 answers
54 views

Synchronize files based only on the existence of unique filenames (Mac OS / Unix)

I am looking for a way to synchronize two folders/volumes based only on whether a filename exists in folder A but not in folder B. I want the sync to completely ignore path and modification dates. ...
Ovidius's user avatar
0 votes
1 answer
2k views

Unix: zip folder ignoring folder structure and excluding a subdirectory

I want to create a zip ignoring the folder structure, and excluding the content of a specific subfolder. I have tried: zip -rj /path/to/target.zip /path/to/source -x "/path/to/source/subfolder/*&...
Alessandro C's user avatar
1 vote
2 answers
793 views

Unix cat and zip together

What I'm trying to do seems simple enough, but I can't get it to work, nor can I find anything on Google referring to how to do this? I want to first cat a bunch of files, then zip the resulting file ...
bk_32's user avatar
  • 123
0 votes
0 answers
109 views

Batch file using WinSCP won't execute UNIX shell script that assigns variables to output of "more" command

I am working with a Batch script that uses WinSCP to transfer files from an UNIX machine to a windows machine. To achieve this, WinSCP has to call shell scripts on the UNIX side. There is one shell ...
Tony E's user avatar
  • 1
0 votes
1 answer
742 views

UNIX or Linux sort: only sort on the first part of an entry

I'm working on a complicated grep, something like grep -E -i "first|next" *.txt, and I get results like: logs.10.txt:2022-10-07 10:33:05.6673 | ClassName | [Info] | Inside function first(), ...
Dominique's user avatar
  • 2,281
1 vote
0 answers
255 views

Attempts to Zip files by date not working as expected

I am trying to zip up a bunch of files, but only those created on a certain date. I'm trying to use the -t option, but it's not finding the files that I can clearly see are there. This is a sample of ...
bk_32's user avatar
  • 123
1 vote
1 answer
249 views

zsh alias for running the most recent matching history item

I'd like to create an alias in zsh that runs my last terminal command beginning with node. I can run that command with !?node, but I can't create an alias with alias N='!?node'. How can I make this ...
Raffi's user avatar
  • 163
0 votes
2 answers
389 views

Accidentally made an alias for a pre-existing command on OS X

I was toying around with aliases and made an alias to take me to the directory where I store all my bash projects via the cd command. However, I used 'bash' as a name for the alias. Now when I run all ...
Caecilius-rgb's user avatar
0 votes
1 answer
459 views

How to do a recursive filename `find` from the shell using a glob pattern with "set braces"

From the shell, I'd like to recursively search a directory for a given glob pattern. But I want to use set-braces-syntax in my pattern: find ~/path/to/dir -name '*.{h,m}' Here I'd like to recursively ...
Todd Ditchendorf's user avatar
1 vote
3 answers
3k views

UNIX/Linux: What's the file permission number?

When I ask for file permissions on a Windows-10 WSL Ubuntu app, I do: ls -ltra And I get information like: -rwxrwxrwx 1 scampsd scampsd 42034 Mar 29 15:26 Filename.cs drwxrwxrwx 1 scampsd scampsd ...
Dominique's user avatar
  • 2,281
1 vote
1 answer
1k views

Keep Color output with grep at systemctl status

I'm trying to get the original color of the output of this command with grep: sudo systemctl status telegraf | grep -e ● -e Active Output of command with this command the output is red, but i want it ...
Tobias2001's user avatar
1 vote
1 answer
235 views

Why do /dev/input/eventX permissions differ depending on how X server is launched?

I have a simple command line binary written in C on Debian that reads USB gamepad input on /dev/input/eventX and shows which gamepad buttons are pressed. I do this by opening and reading /dev/input/...
Synthetix's user avatar
  • 259
-2 votes
1 answer
1k views

How I remove or erase ls -l | head -3 | tail -l to start over. What command I type?

How do I remove or erase ls -l | head -3 | tail -l to start over. What command should I use? Since my ls -l | head -3 | tail - l has double exit1.sh, exit2.sh.it isn’t same picture instruction
Cuong Nguyen's user avatar
1 vote
1 answer
59 views

What makes a new command line (i.e. user@machine:~/directory$) appear in the terminal?

I am writing a Python program and when I interrupt this program, it unfortunately prints lines after the new dollar line has been printed. It looks something like this: [INFO]: Program finishing... ...
Simayy's user avatar
  • 13
0 votes
1 answer
2k views

Is there a way to make Unix diff -r compare only differences in filenames, but not check if any single file actually differs?

I need to compare two large directories with a lot of files in them. I tried using: diff -r Directory1 Directory2 but unfortunately the process is really slow due to the amount of files and their ...
Francesco Ghizzo's user avatar
0 votes
3 answers
314 views

Is there an elegant way to move all sub-directories in the current directory to a new sub-directory?

I often run into the following situation. I am in a directory with several sub-directories like so $ls a b c d I would like to archive directories a-d by moving them into a new directory at the same ...
Cole's user avatar
  • 141
0 votes
2 answers
1k views

Sorting the output of the Windows tree command?

I typically use bash in MSYS2 on Windows, however, I have to inspect a massive network share (on which the MSYS2 version of tree chokes - as in, takes forever), and so I'm forced to use the Windows ...
sdbbs's user avatar
  • 1,402
0 votes
1 answer
511 views

How are bash variables containing a file path with non-ascii characters and spaces used as input for commands, cat, exiftool, etc.?

I have set a variable: myvar='/home/user/shares/D/iPhoto\ Library\ Main.migratedphotolibrary/Data.noindex/2002/102008\ \ name\ lname\ event/PICT0002_2_face0.jpg' Then tried to cat this variable: cat ...
Karl's user avatar
  • 3
1 vote
0 answers
479 views

grep and awk are not displaying output in terminal

When trying to grep Record in .txt file simply $ grep 'Record' file.txt $ it goes to the next line without any output or error (I've tried to write output in file, but it is empty) I've tried also to ...
G D's user avatar
  • 11
0 votes
0 answers
46 views

I need to do bulk find and replace

I have file1.txt with these lines abc def ghi file2.txt with these lines jkl mno pqr jkl jkl mno mno mno pqr I want to write a script that replaces all occurrences of the string jkl in file2....
Wasfi's user avatar
  • 1
0 votes
1 answer
2k views

How to use "find" to print the path instead of "grep" in case of matching file contents

For example, I need to print the paths of all the user's files that contain the word hello. Must use find Use the find command to search, and grep to print the path: find ~ -type f -exec grep -lis &...
Silverfox's user avatar
0 votes
1 answer
125 views

macOS|Unix combine multi-line .txt file into single line with no spaces? (no line breaks)

I've been looking around & I cannot seem to find a command or regex that will do a simple command of combing all linebreaks & spaces in a text file into one line. most of them either add some ...
XxUnkn0wnxX's user avatar
0 votes
0 answers
208 views

Terminal color codes not working as expected

I am using the following code in my ~/.bash_profile following some online blogs. export CLICOLOR=1 export LSCOLORS=GxFxCxDxBxegedabagaced export TERM="xterm-color" export PS1='\[\033[1;32m\]$...
WiggidyMiggidyMcDaddy's user avatar
1 vote
1 answer
2k views

How to keep Midnight Commander running after you open a file?

mc (Midnight Commander) is an excellent CLI file manager, but I have really struggled with this problem: How to get mc to keep running after you choose to open a file? For example, when I navigate to ...
GA90's user avatar
  • 11
0 votes
2 answers
632 views

Execute commands from a remote path

When we execute i.e. ls command the terminal application search for that ls on our PATH variable. The PATH usually contains a number of system directories plus some user specific directories. So a ...
KcFnMi's user avatar
  • 604
2 votes
0 answers
398 views

accesstime on macOS Catalina 10.15

Suppose you own a file system on a unix machine, and you would like to know which of the regular files on this system you have accessed within some interval. ("Regular file" means it is not ...
Jacob Wegelin's user avatar
3 votes
1 answer
2k views

How reliable is the randomness of the shuf command?

I ran the following command to generate 1 billion random numbers: time shuf -i 1-1000000000 > "SHUF TEST 1" To my surprise it was able to do this in less than 10 mins. I then ran the ...
Hashim Aziz's user avatar
0 votes
1 answer
98 views

Why does my bash script not navigate properly?

My final goal for this script is to: Visit folder in loop find the descriptor.mod Rename it to its folder name Relocate it to a specific folder repeat Currently, when I am trying to visit the folder ...
danielmz02's user avatar
1 vote
0 answers
29 views

sorting out files to different directories from a main directory

I have numerous files I am trying to move from a main directory in to separate directories which have multiple sub-directories inside. Example file naming conventions 1SA_1BA_1W.out, 2SA_3BA_3W.out, ...
user1164377's user avatar
2 votes
2 answers
1k views

Can I use bash brace expansion in for loop?

I have some files in directory: touch dir1/dir2/bad\ name{1..4}. I would like to move those files (bad name1 - bad name4) from dir2 to dir1, as well as rename them at once. Because these files have ...
Herdsman's user avatar
  • 371
1 vote
1 answer
132 views

Why do some applications return if already running, and otherwise block?

When using a command line to open multiple tabs in a GUI application, often the first command blocks (waiting until the application is closed) but the subsequent commands each return immediately (...
benjimin's user avatar
  • 211
2 votes
3 answers
522 views

Command line: merge and keep all info from the two files

How to merge and keep all info from the two files as such ? $ cat file1.txt apple cool dude flan $cat file2.txt apple ball cool dude elephant for a result as such : $cat ...
Virginie V's user avatar
0 votes
2 answers
113 views

Speeding up find command result with folder exclusions

I have the following folder structure: Approvals_Share 1 CUST APPROVAL 2 LICENSE APPROVAL CANADA INSCRIBE z-remove There are multiple subfolders and illustrator files “.ai” inside ...
Gio's user avatar
  • 1
1 vote
1 answer
1k views

How to find all files,with substring, e.g. xyz (caseinsensitive) in filename within particular type (*.txt) using linux command line?

I have some bunch of files, which has "xyz" in the filename, This "xyz" can be case insensitive, e.g. "XYz" or "xYz". Wish to display all possible combination of the files in from current working node
Adsignals's user avatar
2 votes
4 answers
10k views

Bin folder for Windows 10

I'm trying to replicate a UNIX bin folder on my Windows 10 PC. I have created a folder located at "C:\bin" and added it to my PATH variable. However, I'm not really sure as how to implement it any ...
Samuel Ivarsson's user avatar
3 votes
2 answers
919 views

"watch" command not displaying "tree" command output with Unicode bars and dashes

When executing watch tree . I get output as follows Every 2.0s: tree . macbook.local: Fri Dec 20 16:23:33 2019 . hello.txt hi.txt hmm.c subdir ...
Anik Iqbal's user avatar
2 votes
2 answers
1k views

Is there a way to make sed not wait for complete lines?

sed seems to process its input line by line. This is usually not a problem, but if you have really long lines, you can run into issues. For example, the following command never outputs anything: { ...
Peltier's user avatar
  • 6,324
4 votes
2 answers
13k views

How to run the file command recursively

I'm trying to get information about the types of all the files in a given directory tree. Running file * in the current directory works well enough, but it doesn't traverse into sub-directories and ...
Hashim Aziz's user avatar
2 votes
1 answer
1k views

Where did my files go after using mv command?

All my .c source files and a Readme file were in a subdirectory called assignment2 in a directory called Assignment2. Originally, from assignment2 directory: $ ls corrupt.c decode.c encode.c fix.c ...
Cid's user avatar
  • 21
0 votes
1 answer
230 views

Replace files recursively

I have a deeply nested directory called MyProject which contains dozens of git repositories. Each of those repositories contains, somewhere, a directory called utils which contains a file called ...
j_d's user avatar
  • 123
0 votes
2 answers
76 views

control seq for errors in unnamed pipe

$ awk -v f=<(cmdmayfail) -e 'BEGIN { r = getline < f ; print r }' -bash: cmdmayfail: command not found 0 In the above-unnamed pipe example, awk will not know the error from the unnamed pipe. $ ...
user1424739's user avatar
3 votes
1 answer
1k views

Bash autocomplete with wildcard

I would like to type in the terminal like I do in emacs: emacs 2019-*subject* When I hit Tab I get the first match: 2019-08-03-subject.markdown What I would like is for it to show me the options ...
Pandian Le's user avatar
0 votes
1 answer
1k views

Running several asynchronous tasks and get their outputs and exit codes in bash

I have to run a bunch of commands asynchronously and as soon as one finishes, I need to perform actions according to its exit code and output. Note that I can't predict how for long any of these tasks ...
Informancien's user avatar
0 votes
0 answers
1k views

How to recover the System after rm -r / -command string

I'm willing to learn how to recover the System after system administrator (root user) have hit "rm -r /" -command string by accident after learning some new nice commands. My customer is humanist ...
Jere_Sumell's user avatar
1 vote
1 answer
216 views

How to make command line tool “ctpu” be recognized by my terminal?

I downloaded the ctpu command-line tool made by Google. This tool makes it easy to set up and run Cloud TPUs for deep learning projects. I successfully downloaded the tool to my ~ directory (Users/...
parrot15's user avatar
  • 111
1 vote
2 answers
2k views

using 'rm -rf' safely [duplicate]

I'm fairly new to unix and I have seen a lot of warnings against using rm -rf. Example: "But, always double check before you use rm -rf command, if you by mistake give this command in your home ...
user avatar

1
2 3 4 5
9