/r/commandline

Photograph via snooOG

This is for anything regarding the command line, in any operating system. All questions (including dumb ones), tips, and links to interesting programs/console applications you've found or made yourself are welcome. Linux / BSD / OSX / Windows CLI and TUI apps or questions or comments, we're happy to take them all!

  -----------------------------

/ This is for anything
| regarding the command line, | | in any operating system. All | | questions (including dumb | | ones), tips, and interesting | | programs/console applications | | you've found or made yourself | | are welcome. Please read the | | rules, and you're welcome to | | flair your posts if you want |

\ to. /
\   ^__^
 \  (OO)\_______
    (__)\       )\/\
        ||----w |
        ||     ||

commandline@reddit ~ $ _


If you're asking for help, remember to help the community by stating what OS and version you're using, and if at all possible paste any commands you've tried and any errors or output that you've seen.


Related subreddits:

/r/commandline

97,283 Subscribers

2

How can I make a batch command to convert all files in a folder using ffmpeg + gifski with an existing .bat file?

Hello, Im an extreme noob and hope it's okay to ask this here. A friend wrote me a .bat file to use command line to convert mp4 to png and then use gifski to convert to GIF (this is how it works for gifski on Windows - mp4 needs converted to png and then feed the png into gifski to create the GIF). The thing is he has gone on holiday and I don't want to bother him, so I'm trying to figure out on my own. Here is a screenshot of the .bat file he created for me (some instructions are in spanish though):

https://preview.redd.it/z9hvgaznv5yd1.png?width=1048&format=png&auto=webp&s=6fb8828a9d0b4ea471ad28c01766c3fe191f6c93

It works flawlessly, but the only inconvnience is I need to do it file per file. I'd love to just stick all files in one folder and convert them in batch, but I have no idea how. I'v tried following some instructions from google but I'm not being able to succeed.

Sorry if this is too basic, if not allowed please delete! It's just that command line for me is pretty much like reading hieroglyphics

9 Comments
2024/10/31
21:41 UTC

3

What do you think of these kind of visual cartridge to distribute CLI software?

0 Comments
2024/10/31
15:29 UTC

3

My little dino game

0 Comments
2024/10/31
14:31 UTC

83

ResTop -- The resources application for the TUI version.

7 Comments
2024/10/31
14:12 UTC

21

muse - cli image color manipulation (using lospec txt files)

7 Comments
2024/10/31
05:53 UTC

2

Github browser

the text browsers are bad at this. does anyone know a git browser? ideally, without downloading the repo: search for repos; browse repos and open the readme; browse and open the issues list; browse the wikis. gh command requires a web browser which is what i am trying to avoid thank you

8 Comments
2024/10/30
23:36 UTC

8

I present: Managarr - A TUI and CLI to manage your Servarr instances

After almost 3 years of work, I've finally managed to get this project stable enough to release an alpha version!

I'm proud to present Managarr - A TUI and CLI for managing your Servarr instances! At the moment, the alpha version only supports Radarr.

Not all features are implemented for the alpha version, like managing quality profiles or quality definitions, etc.

Here's some screenshots of the TUI:

https://preview.redd.it/pbkbldryzyxd1.png?width=1903&format=png&auto=webp&s=6886b98ccbcb4f7a1570f925d762d478458cb24a

https://preview.redd.it/aa9u5dryzyxd1.png?width=1903&format=png&auto=webp&s=8f96596a17ae8e8e037b4e917ebc93d97ff6ab97

https://preview.redd.it/c463bdryzyxd1.png?width=1903&format=png&auto=webp&s=29fe348bf932164b70679d09475a9c3c6f16f78c

https://preview.redd.it/on1l0eryzyxd1.png?width=1903&format=png&auto=webp&s=5585918cbd0e9e4b928b3de72ed1f4f609a2ac15

https://preview.redd.it/irprldryzyxd1.png?width=1903&format=png&auto=webp&s=cd523b4c74f820c9b29e1207d496c65d10c33a10

https://preview.redd.it/8acxwdryzyxd1.png?width=1903&format=png&auto=webp&s=534d6a3db7bc11c103353afef61b300cbc67e612

https://preview.redd.it/x4wpheryzyxd1.png?width=1903&format=png&auto=webp&s=64228fa3c3cc16abb8b03d77dd1f164bb311f968

Additionally, you can use it as a CLI for Radarr; For example, to search for a new film:

managarr radarr search-new-movie --query "star wars"

Or you can add a new movie by its TMDB ID:

managarr radarr add movie --tmdb-id 1895 --root-folder-path /nfs/movies --quality-profile-id 1

All features available in the TUI are also available via the CLI.

2 Comments
2024/10/30
22:33 UTC

243

nchess, a curses based chess GUI

https://github.com/spinojara/nchess

nchess supports the full move rules of chess and runs on both Linux and Windows. You can play games, edit and analyze positions. On Linux you can connect UCI engines (i.e. Stockfish), but unfortunately this is not supported on Windows yet.

Please try to break it or make it do weird things as this is the first release!

23 Comments
2024/10/30
20:06 UTC

16

A Telegram CLI Client

I wrote a simple cli client for telegram using the telethon library to quickly send files and messages. I would appreciate some feedback. Thanks

dark-send

9 Comments
2024/10/30
14:57 UTC

1

C-BSpace cannot be detected in tmux (asciiville config) despite there is no action already attached to it

so i went to try tmux, wondered why default shortcuts doesn't work, found out that it uses asciiville config, which i forgot that i installed a while back ago

anyway, understood the binds in the config and used it according to that config, however, when i try to delete a whole word using c-backspace (which is set in .zshrc itself, not in the terminal), it doesn't work

tried unbinding, rebinding C-BSpace to ^H, etc, nothing worked

tried `cat` and pressed c-backpace, and nothing printed, usually when i'm outside of tmux, it prints `^H`

here is the tmux config

## Custom key bindings

# Switch windows using Alt-PgDn and Up without prefix
# bind-key -n M-Right next-window
# bind-key -n M-Left  previous-window
# bind-key -n M-n     next-window
# bind-key -n M-p     previous-window
bind-key -n M-PgDn next-window
bind-key -n M-PgUp previous-window

# Switch panes using Alt-arrow without prefix
bind-key -n M-Left select-pane -L
bind-key -n M-Right select-pane -R
bind-key -n M-Up select-pane -U
bind-key -n M-Down select-pane -D

# Resize panes
# bind-key -r C-Left resize-pane -L 5
# bind-key -r C-Right resize-pane -R 5
# bind-key -r C-Up resize-pane -U 2
# bind-key -r C-Down resize-pane -D 2
#
# Use vim key bindings and mode
bind -r j resize-pane -D 5
bind -r k resize-pane -U 5
bind -r l resize-pane -R 5
bind -r h resize-pane -L 5
bind -r m resize-pane -Z

set-window-option -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection # start selecting text with "v"
bind-key -T copy-mode-vi 'y' send -X copy-selection # copy text with "y"
unbind -T copy-mode-vi MouseDragEnd1Pane # don't exit copy mode when dragging with mouse

# Exit session
bind-key -n M-x confirm-before -p "kill-session #S? (y/n)" kill-session
bind-key -n M-X kill-session
bind-key q confirm-before -p "kill-session #S? (y/n)" kill-session
bind-key Q kill-session

# Remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

# Reload config file
unbind r
bind-key r source-file ~/.tmux.conf\; display ' Reloaded tmux config.'

# Split panes using | and -
bind-key | split-window -h -c '#{pane_current_path}'
bind-key - split-window -v -c '#{pane_current_path}'
unbind '"'
unbind %

# Shift + arrow key to move between windows
bind-key -n S-Left  previous-window
bind-key -n S-Right next-window

# Sync panes
bind-key s set-window-option synchronize-panes
1 Comment
2024/10/30
09:24 UTC

38

I wrote a very minimal terminal emulator from scratch, and I can use some feedback!

Why?

I was reading Linus' book, "Just for Fun" and he was talking about when was working with his Sinclair QL, he hated the text editor that came with it, because it was so slow, so he wrote his own in assembly which was significantly faster. Later he also was working on a terminal emulator with assembly to learn the architecture of his computer and he ended up writing his own kernel that we all know and love.

So I also wanted to make something like that, i thought I'd do a terminal, because you get some part of building a text editor and some experience with the os and important system calls. I obviously wasn't gonna use assembly, because I'm not good with it and even if I was I couldn't imagine writing more efficient code that would make it faster than C with all the compiler optimizations these days.

Anyways it's currently at a very basic level, it currently doesn't even support scrolling and I'm implementing that, this very moment. I was thinking of having a circular connected lines of text, so that if the last line is filled, the next line is stored in the first (0th) line and then the original line at that place must be stored somewhere? Idk i want to do something quick, and don't wish to move memory and create more memory everytime i have to scroll

I've used Pty/pseudoterminals to emulate shell, thanks to a tutorial by eduterm

I'll be happy to work on some suggestions.

20 Comments
2024/10/29
20:14 UTC

26

SmartCat: my attempt at making the most efficient LLM tool for terminal dwellers

Hey everyone, I wanted to share and get feedback on my pet project that quickly became a pillar of my current engineering workflow.

https://github.com/efugier/smartcat/

First of all, I am aware of other initiatives. Let me get straight to why this may be different, and why it works better for me than any other tool I've tried.

This tool makes LLMs available as text manipulation entities in the CLI; you pipe text in and you get some result. smartcat is designed to make this pattern and all its many applications as efficient and straightforward as possible.

You can pipe in a simple question, some text to reformat, explain a stack trace, refactor some code, write the v0 of some function to iterate on, a quick script etc.

In the end, with it being available in terminal and editor (vim, kakoune, helix... all support piping selection into the CLI), it completely eliminated the need for Copilot and other completion tools for me. I much prefer the workflow and control this offers.

Now, feature-wise, what are the highlights?

  • Minimalistic
  • Plug and play, behaves well in the terminal by default (no explanation or parasitic text)
  • Built with workflow efficiency as the top priority, minimizing keystrokes to get your job done
  • Being a good Unix terminal citizen, meaning it works well with streams and thus "integrates" natively with all terminal editors (vim, kakoune, helix) by piping the selection into it
  • Configurable prompts that can be tailored to specific and repetitive tasks (refactoring, testing, explaining an error in the stack trace)
  • Continue the last conversation to iterate or get a sligtly different result

More details (and workflow gifs) in the README.

As the target audience for this tool I would love for you to share feedback, especially on the documentation and README as it's always hard to accurately gauge how confusing things can be when you're the one that built it.

I hope you find it as useful as I do!

5 Comments
2024/10/29
13:06 UTC

10

How to overwrite nerd font icons?

For instance, I want to replace the nf-md-numeric_1_circle_outline icon (you can search that in https://www.nerdfonts.com/cheat-sheet to see), with this Apple SF Symbol 1.circle instead. I use a nerd font in Neovide (an Nvim GUI), where I can paste in the text character for 1.circle and it shows correctly without additional steps. On nerdfonts.com, it says at the bottom "You can even specify a custom symbol font with the --custom option to include even more glyphs." but I didn't find any instructions for how exactly to make a font file with the glyphs I want. I want to be able to overwrite any nerd icon with one in the SF Symbols app.

https://preview.redd.it/vhk9krhl6kxd1.jpg?width=274&format=pjpg&auto=webp&s=32325713dcbcb7858d876b3dec1fed9de4083e59

1 Comment
2024/10/28
20:47 UTC

0

Last Showcase of Ghostty Before Release

12 Comments
2024/10/28
09:40 UTC

3

Feedback Needed: Analytics Solution for CLI Tools (Google Analytics for the Command Line)

Hi everyone! 👋

I’m exploring the idea of a plug-and-play analytics solution designed specifically for CLI applications — think Google Analytics, but tailored to CLI tools. Here’s a rough outline of what I envision:

  • SDKs for Major Languages: Simple integration for popular languages used in CLI development (Go, Python, Rust, etc.)
  • Command Execution Tracking: Automatically tracks command usage with configurable granularity and privacy options.
  • Error and Crash Reporting: Built-in crash and error reporting to help identify and prioritize issues.
  • Opt-in/Opt-out Flexibility: Support for customizable privacy strategies to ensure users can choose their data sharing preferences.
  • Web Dashboard for Data Analysis: Centralized interface to analyze collected data, usage patterns, and errors.

I started thinking about this after hitting roadblocks in prioritizing features and fixing bugs in my own open-source CLI tool. Now, I’m curious to know if others see value in a tool like this.

Does this sound useful for your CLI projects? Are there any features you’d need or concerns you’d have?

Any feedback would be hugely appreciated 🙏 Thank you in advance!

0 Comments
2024/10/28
05:24 UTC

41

how to login a site on the lynx browser

6 Comments
2024/10/27
17:41 UTC

3

Just accidentally typed ld instead of ls

The header says is all. I typed ld instead of ls. Nothing happened for a few seconds so I CTRL+C‘d. Then I remembered ld is the linker and I tried the usual to find out, if sth. happens, if you run it without any parameters, but it doesn’t look like. I now also get an error, if I just type ld. Is it normal that some tools take a little longer, if you execute them for the first time (I guess ld has been run before internally, hasn’t it)? Also, is it bad in anyway, if you cancel the first execution with an CTRL+C? Will you interrupt some kind of initialization?

10 Comments
2024/10/26
23:00 UTC

23

chaftrix: image rendering + animation + matrix effect in terminal window (c, chafa)

11 Comments
2024/10/26
21:37 UTC

20

Using fabric, fzf and vipe to automate repeatable tasks with AI in a terminal

Fabric is a real time saver for many repeatable tasks when using AI in terminal.

To make it a little easier to use, I've created a simple script to orchestrate fabric commands.

Here is a video about it if anyone is interested.

fabric automation

3 Comments
2024/10/26
16:38 UTC

13

QuickSched v1.4.0 - Scheduling your entire week has never been easier

2 Comments
2024/10/25
21:19 UTC

49

No one else cares but maybe you guys will... look at my terminal. Right now wttr.in is down so ignore the weather failure. Ordinarily, it would show something like this DC: ⛅️ +62°F

5 Comments
2024/10/25
20:09 UTC

5

compare 2 directories and only keep audio files of a longer length/duration

hi im trying to find a script to compare 2 directories full of audio files from a Visual novel
and for it to only keep the audio files that the length/duration is longer

the file extension is .ogg
the directories are
$folder1 = "D:\Newfolder3\Newfolder\test\"
$folder2 = "D:\Newfolder3\Newfolder2\Newfolder\test\"

and for the story i made the fruit of grisaia patch for the steam
but recently i found out some of the lines are cut off
due to the censorship of the steam version
so i have all the lines of the unrated version in 1 folder
and the lines from the steam version in another
the unrated would have the longer dialog
hence if i have a script to automatically do this
it would be a huge help since there are almost 25,000 audio files in each folder

update:
i think i got a script that does the job with file size instead

# Define the directories
$dir1 = "D:\Newfolder3\pcm1\"
$dir2 = "D:\Newfolder3\pcm2\"

# Get the list of files in directory 1
Get-ChildItem -Path $dir1 | ForEach-Object {
    $file1 = $_
    $file2 = Join-Path -Path $dir2 -ChildPath $file1.Name

    # Check if the corresponding file exists in directory 2
    if (Test-Path -Path $file2) {
        # Get the file sizes
        $size1 = $file1.Length
        $size2 = (Get-Item $file2).Length

        # Compare sizes (100 KB = 102400 bytes)
        if ($size1 + 102400 -le $size2) {
            Write-Host "Deleting $($file1.FullName) (size: $size1 bytes) because $($file2) (size: $size2 bytes) is larger by at least 100 KB."
            Remove-Item -Path $file1.FullName -Force  # Delete the file
        }
    }
}
14 Comments
2024/10/25
20:01 UTC

1

Global history for remote sessions?

I'm trying to brainstorm a solution for a way to capture history locally across multiple remote sessions for multiple accounts. Basically I want a .bash_history file for me, the human, not my various accounts across systems. I tried doing something with a local keylogger, but in addition to capturing passwords, the output there is not very useful:

cd /h[TAB]m[TAB]bi[TAB][^A][DEL][DEL]ll[^M]

Example scenario: I need to run a diagnostic command as user1@server1 and upload the results to the vendor via my browser.

  • Log into the server, su to user1, diag.sh > ~/output1
  • su to root, cp /home/user1/output1 /home/me/
  • chown me:me /home/me/output1
  • Back to my local machine and scp me@server1:output1 .
  • Then upload the file, which isn't a CLI thing.

I'd love some way to have a local file with the following contents:

[2024-10-15 17:30:57] me@localhost  ssh me@server1
[2024-10-15 17:31:02] me@server1    sudo -iu user1
[2024-10-25 17:31:05] user1@server1 diag.sh > ~/output1
[2024-10-25 17:32:18] user1@server1 exit
[2024-10-15 17:32:20] me@server1    sudo su -
[2024-10-15 17:32:23] root@server1  cp /home/user1/output1 /home/me/
[2024-10-15 17:32:26] root@server1  chown me:me /home/me/output1
[2024-10-15 17:32:28] root@server1  exit
[2024-10-15 17:32:44] me@localhost  scp me@server1:output 1 .
4 Comments
2024/10/25
19:42 UTC

0

What are you using debian (no gui) or ubuntu server in retro pda if you fail to install with gnome or other?

So I have the craziest idea to install debian on outaded pda so first I'm wondering on amazing sony Vaio ux 390n which by this pc was Thanks to such a computer, the ssd was born if I fail by grub rescure will try to install in some old pda or unknown retro thinkPad tablet with build in keyboard (what model?) or even apple powerbook.

5 Comments
2024/10/25
19:30 UTC

27

Curd : Watch anime in cli

This program was previously in Python i just re-wrote the entire thing in go lang.

Features: Stream and track anime, Anilist integrations, Discord RPC, Skip Intro/Outro/Filler/Recap, etc.

Works in windows and linux

Checkout the project here Github

37 Comments
2024/10/25
06:00 UTC

0

A cli torrent client that is dependency-free, made in C/C++ -- is it even possible?

Title. Been looking for something like that since forever and I can't find it -- can someone give me pointers? Thanks in advance.

16 Comments
2024/10/24
23:48 UTC

6

Run command that needs root password with a script?

(MacOS 10.15.7 if it matters)

I recently got a VPN and to activate it after rebooting my computer i have to load the .conf file with Wireguard using the command "sudo wg-quick up ./configfile.conf", and then i have to enter my password.

I would like to create a script that does this for me so i don't have to type it all in the Terminal every time I start my Mac. However, when I run the script it obviously still asks for my password. What can I put in the script that will bypass that?

Thanks in advance to anyone who can help me with my beginner question, I'm new to this stuff but I'm excited to learn!

14 Comments
2024/10/24
14:35 UTC

8

jq update object with data from other json

Hi,

I would like to update a json with data from another json, but i have no clue how to do this using jq.

A.json:

[
    {
        "name": "a",
        "files": [
            "a",
            "aa"
        ]
    },{
        "name": "b",
        "files": [
            "b",
            "bb"
        ]
    }
]

B.json:

[
    {
        "name": "b",
        "files": [
            "b",
            "bb",
            "bbb",
            "bbbb",
        ]
    }
]

restult.json

[
    {
        "name": "a",
        "files": [
            "a",
            "aa"
        ]
    },{
        "name": "b",
        "files": [
            "b",
            "bb"
            "bbb",
            "bbbb",
        ]
    }
]
12 Comments
2024/10/24
12:23 UTC

Back To Top