/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,443 Subscribers

1

ipd - IP bot detection and IP geolocation command line utility

HI all, I just released a IP bot detection and IP geolocation command line utility for IPDetective.

You can use it for free without an API key however you may be rate limited depending on the amount of requests you are making.

This tool should help you easily determine the amount of IP addresses that are bots (datacenter, botnet, proxy or VPN) and determine IP country of origin.

Please let me know if you have any questions.

https://github.com/AndrewCopeland/ipd

0 Comments
2024/11/10
17:11 UTC

10

Portable CLI tar.gz installer

I'm working on a tiny package manager of sorts for tar/tar.gz/tar.xz and similar formats. It works on Linux and macOS for now, but it's built to be portable and extensible so it'll probably be on Windows, BSD and others fairly soon. I use it myself to install annoying programs like Discord.

https://github.com/Alessandro-Salerno/tarman

https://i.redd.it/xdghdmbix10e1.gif

0 Comments
2024/11/10
10:31 UTC

1

Scan a music directory for all new albums in the last 10 days, select the ones you need a playlist of.

This was something that was missing from the tools that I currenly use, luckily with a bit of fzf and a single incantation, I had a terminal 'app' doing exactly what I wanted. It uses ripgrep and fd rather than grep and find respectively. Posting in case it is useful:

https://gist.github.com/veebch/e925cbd977ee205c0e495c98a2791352

Tested and working with ncmpcpp. Shared due to my perpetual amazement that you can do this stuff with linux.

2 Comments
2024/11/10
09:00 UTC

20

[DevLog #01] Gmail-TUI: Replicating The Gmail-Web Experience In Terminal

Gmail-TUI is a simple TUI application that aims to replicate the Gmail Web-UI in a TUI-Environment. Is this even possible? I don't even know yet but let's find out! Special thanks to Rivo for their TUI Library.

Composing & sending a mail using Gmail-TUI

As shown above (or here if the GIF didn't load), today I was able to implement the composing and sending of Emails using this SMTP guide. The source-code is available in the Project-repository and modifying the code to enhance the project is most welcome!

Some Background

As scary as this is for me, here I am trying to do something new with my life: Publicly writing about my project so that I actually end up completing it and also hopefully getting the much needed feedback along the way!

Just a few days after I had installed Ubuntu, I lost the access to the GUI due to a failed and interrupted update. This led to me being forced to use the TTY-environment (started using the `ctrl+alt+fkeys` combination) and ending up feeling helpless for a long time as I had never used even the most basic Linux commands.

Months later, this experience led me to look into TUI or Terminal based User Interfaces, which run on Terminals and are like lighter versions of GUIs. This is where the idea of creating my own TUI-Application for Gmail came into mind as I was unable find one that could fit my use-case.

Required Features

To complete this lack of TUI-Application, I would like the Gmail-TUI to borderline replicate the web-version of Gmail, allowing users to perform most of the core tasks by providing following features/functionalities in it:

  • A login page for entering email-ID and password
  • Composing and sending mails - Implemented!
  • Listing received emails with email-IDs in the Inbox
  • Opening the content of the received mail after clicking it
  • Viewing sent email in Sent-Box
  • A small panel on the left side to choose from the Compose, Inbox, Drafts, Sent buttons.

I will be trying to work on the login-page for now, where the user will enter their credentials, click on login and be redirected to the next page where they would be able to compose mails. Like the web-version, showing the Inbox after signing-in should be done but since I am still studying IMPS that will help with receiving emails, I will be using the Compose-mail section as the placeholder for now.

0 Comments
2024/11/09
22:30 UTC

3

Custom Command Expansion with ZLE

A video about using ZLE (Zsh Line Editor) and zsh expansion to build a reusable command line abbreviations engine.

https://youtu.be/_QKNWZHDH7M

0 Comments
2024/11/09
19:18 UTC

6

Zoxide VS cd command

Zoxide is an open-source tool that works like a "smarter CD command"!

It can remember the directories you've already used, allowing you to "jump" to them with just a few keystrokes.

https://reddit.com/link/1gn91rk/video/v408uqbfdvzd1/player

πŸŽ₯ Check out the video:
https://www.youtube.com/watch?v=gWu7n8A2_DM

5 Comments
2024/11/09
12:29 UTC

14

Terminal of preference?

I’ve used WindTerm / Guake / iTerm, heard about WezTerm, know any others? Have a preference & why?

61 Comments
2024/11/09
11:04 UTC

3

How can I copy files (like PDFs and images) to the clipboard from the macOS terminal?

Hello! I'm a new computer science student and have been using the terminal more frequently on my Mac. One thing that's been frustrating is not being able to copy filesβ€”such as PDFs and imagesβ€”directly to the clipboard from the terminal. For instance, I’d love to type something like copy file.pdf and then be able to paste it (with Cmd + V) directly into apps like ChatGPT without having to open the Finder and drag the file in.

Is there a command-line tool or script for macOS that would let me copy files to the clipboard as if they were manually copied? Any tips would be greatly appreciated!

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

Edit: A solution was found thanks to u/4esv They suggested using AppleScript with osascript, which works flawlessly. Here’s the function they shared:

yoink() {
osascript -e "set the clipboard to (POSIX file \"$PWD/$1\")"
}

4 Comments
2024/11/09
10:01 UTC

2

Access google mail with aerc (cli email client)

Hello everybody,

maybe you can help me. The sources on the internet can't anymore.

I have installed aerc and I have create a google mail app password.

I have configured aerc accordingly (IMAP, SMTP, STARTTLS) with that very app password but
unfortunately I can't fetch my emails.

Any idea is more than welcome.

The error I get is:

Googlemail: EOF
Googlemail: reconnecting
Googlemail: reconnect in 3s
Googlemail: reconnect in 2s
Googlemail: reconnect in 1s
Googlemail: reconnecting

This is my configuration:

File: accounts.conf

───────┼─────────────────────────────────────────────────────────────

1 β”‚ [Googlemail]
2 β”‚ source = imap://my.name%40googlemail.com:password@imap.googlemail.com:993
3 β”‚ outgoing = smtp://my.name%40googlemail.com:password@smtp.googlemail.com:587
4 β”‚ default = INBOX
5 β”‚ from = "My Name"Β my.name@googlemail.com
6 β”‚ cache-headers = true

It should be working because I did create a password with Gmail for the purpose of the app as Google suggests here (16 letters password):Β https://support.google.com/accounts/answer/185833?hl=en

Best regards

2 Comments
2024/11/08
21:01 UTC

1

Is there a stand-alone version of the fc command?

It would be nice if I could use fc in shells that don't have it as a built-in. I haven't been able to find anything on GitHub or with Google, but thought I would ask here before I give up.

4 Comments
2024/11/08
01:53 UTC

10

weft πŸͺ’ - a vim-styled terminal reader to chat with your books

Just hacked together a fun little terminal reader that lets you weave through books with vim-like navigation while chatting with them using AI.

Navigate like you're in vim: h/l between chapters, j/k to scroll, g/G to jump around β€” and arrows, ofc

  • ask questions to the text - incl. references to sections, chapters, book & its metadata
  • summarize current section
  • toggle toc
  • read passage
  • quit whenever

And my favorite, press > for an AI narrator that situates you in the current scene/chapter.

Should work with any .epub file.

Built this because I wanted a more interactive way to "move" around books and go broad or deep in the text using an AI companion. And who knows, perhaps uncover insights hidden in some of these books.

Code & setup instructions: https://github.com/dpunj/weft

Quick demo: https://x.com/dpunjabi/status/1854361314040446995

Would love to hear your thoughts/feedback!

15 Comments
2024/11/07
20:55 UTC

88

🧩 x starship - A prompt theme, theme preview with fzf, quickly switch themes using, Simplified Setup!

12 Comments
2024/11/07
10:28 UTC

0

What is a command and what are options in a "git push origin main"?

What is a command and what are options in this sequence git push origin main?

AFAIK, commands that are not Shell-integrated have their own binaries, meaning that git command should have its binary executable file, making it also a CLI program and not "pure" command.

Starting from this, is git push another separate command/program with its own binaries? Or push is an option that was programmed to be passed without the dash character?

I guess origin is an option? But it's also passed without the dash character.

5 Comments
2024/11/07
08:38 UTC

1

Built a Claude AI helper function for fish shell - because iTerm AI only supports OpenAI

Hey folks! πŸ‘‹

iTerm recently launched their AI feature where you can ask questions in natural language and get commands. But it only supports OpenAI's API, and I'm a Claude user. So I built a fish function that does the same thing!

What it does

  • Takes natural language input and returns the correct command for your system
  • Detects OS type and version (macOS/Linux) for accurate commands
  • Places the command on your prompt for review (no auto-execution)
  • Works with the latest Claude 3 models

Example usage

> ask-claude "flush DNS cache on my Mac"
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

> ask-claude "find large files taking up space"
find . -type f -size +100M -exec ls -lh {} \;

How to use it

Get a Claude API key from Anthropic Set these in your config.fish:

set -gx CLAUDE_MODEL "claude-3-sonnet-20240229"
set -gx CLAUDE_API_KEY "sk-ant-..."

Drop the function in your fish functions directory

Check it out on GitHub: [ask-claude] (https://github.com/MugunthKumar/ask-claude) PRs welcome! Planning to add support for more shells and Windows in the future.

2 Comments
2024/11/07
04:21 UTC

215

This is a curl headquarters!

15 Comments
2024/11/06
17:30 UTC

10

Modern Bash setup?

I'm a Fish user and I'm thinking of switching to Bash, because I want to share scripts and commands with my team, they all have Bash installed. My Fish setup is pretty robust, I have Vi mode,Β atuinΒ for command history, Fish command and argument name completions, syntax highlighting. I'm wondering, do you, people who run Bash on their machines daily, have a way for configuring Bash in a similar way? For what i searched and tried,Β ble.shΒ provides completions and highlightings, Vi mode is supported by Bash by default, and you can getΒ atuinΒ to work withΒ ble.sh. ButΒ ble.shΒ feels kinda laggy and slow, and I don't really like it's Vi mode implementation (i can't evenΒ ctrl-cΒ in there). Is there any alternatives?

24 Comments
2024/11/06
10:24 UTC

7

ParScrape v0.4.7 Released

What My project Does:

Scrapes data from sites and uses AI to extract structured data from it.

Whats New:

  • BREAKING CHANGE: --pricing cli option now takes a string value of 'details', 'cost', or 'none'.
  • Added pool of user agents that gets randomly pulled from.
  • Updating pricing data.
  • Pricing token capture and compute now much more accurate.
  • Faster startup

Key Features:

  • Uses Playwright / Selenium to bypass most simple bot checks.
  • Uses AI to extract data from a page and save it various formats such as CSV, XLSX, JSON, Markdown.
  • Has rich console output to display data right in your terminal.

GitHub and PyPI

Comparison:

I have seem many command line and web applications for scraping but none that are as simple, flexible and fast as ParScrape

Target Audience

AI enthusiasts and data hungry hobbyist

https://preview.redd.it/3twvx2alg5zd1.png?width=1379&format=png&auto=webp&s=786c1d97a1b34cf10ae236800efbe936bf258044

2 Comments
2024/11/05
21:19 UTC

1

How to make a script run silently?

So I have the following .bat file that runs in CMD:

cd C:\Users\xxxxx\AppData\Local\Programs\WinSCP
winscp.exe /console /script="synctolocalscript.txt" /log=mylog.log"

This opens a WINSCP cmd window that actually does the main part to pull some information. So this runs every minute on my PC, but the problem is that every minute I am getting 2 cmd windows popping open and running for about 10 seconds, then closing, so interrupts anything I am working on at the time.

I am still fairly green when it comes to scripting and cmd line stuff, so I am not sure how exactly to make this run silently. Do I do it in the initial cmd line bat file? The synctolocalscript.txt WINSCP file? Or Windows task scheduler where this is scehduled at?

6 Comments
2024/11/05
15:45 UTC

0

Is terminal emulator kind of framework for developing non-graphical apps?

I never developed CLI apps, and was wondering do terminal emulators provide some kind of universal technical standard when it comes to software development? Meaning, is there some specification a developer needs to follow in order for his binaries to be working inside a terminal emulator? Like there are frameworks for building GUI apps, are software terminals (among other things) one of a interface paradigms for developing apps?

19 Comments
2024/11/05
15:24 UTC

1

[Windows] Command for getting the current system locale date format

I'm trying to determine the current system locale date format so I can format the dates correctly for the schtasks-create command.

Is there a cmd or powershell command that can get me this info?

https://preview.redd.it/lz0rva1jw0zd1.png?width=880&format=png&auto=webp&s=d5a2a4e39aef0a5a7bdec7ff7d22e166d18b85b7

1 Comment
2024/11/05
05:59 UTC

6

My Mac’s ZSH Terminal Takes About a Minute to Load – Suspect Homebrew Issues and Need Help

24 Comments
2024/11/04
19:43 UTC

57

Zellij 0.41 release: non-colliding keybindings, configuration live reloading, a new plugin manager and loads more!

Hi fellow denizens of the amazing text-box,

I'm the lead developer and maintainer of Zellij - a terminal workspace that does not sacrifice simplicity for power. And I'm here to share the latest release that's hot off the presses. This release includes lots of new cool stuff. Some highlights:

  1. A non-colliding keybinding preset for those of us who were plagued by Zellij overriding certain keys they use in the terminal (eg. `Ctrl o` for vim's jumplist)
  2. Configuration live reloading
  3. A new plugin manager
  4. A new Configuration screen to rebind leader keys
  5. Support for multiple modifiers

And really, loads more. Check out the official announcement (where you can also see a screencast of me walking you through some of these new features): https://zellij.dev/news/colliding-keybinds-plugin-manager/
And also the full release notes: https://github.com/zellij-org/zellij/releases/tag/v0.41.0

Happy hacking and I hope you enjoy!

8 Comments
2024/11/04
13:03 UTC

1

Mobaxterm Pasting from Copy Q or Windows Clipboard not working

I'm encountering a strange issue with Mobaxterm's pasting functionality after rebinding the paste command. I wanted to change the default Ctrl + Shift + Insert to Ctrl + V to make pasting quicker and more intuitive. However, when I try to paste using the new keybind, my CopyQ clipboard manager opens, but nothing actually pastes from it. The same thing happens when I try to use the Windows clipboard. (and its really annoying because I like using the clipboard for pasting sometimes)

To clarify, the Windows clipboard integration hasn’t worked at all, not even with the default settings. I’ve seen suggestions to right-click to paste or simply stick to Ctrl + Shift + Insert, but as a keyboard-focused user, that’s not an ideal workaround. I work with frequent copy-paste actions, so constantly reaching for the mouse would disrupt my workflow and slow me down.

If Mobaxterm doesn't support custom rebinding for pasting from CopyQ or the Windows clipboard, I might need to explore alternative tools. If anyone has encountered this or found a workaroundβ€”or if there’s another terminal tool that supports more flexible key bindingsβ€”I'd love to hear your suggestions.

FYI I tried ditto clipboard manager, But it was not able to paste from the clipboard, even with the default settings of mobaxterm, without rebinding anything.

0 Comments
2024/11/04
06:19 UTC

12

Automate Your macOS Setup by Generating PlistBuddy Commands

I have a demo!

Here's what the tool does:

  • Tracks changes made to system or app preferences.

  • Generates PlistBuddy commands.

With this, you can script your macOS setup and recreate your environment on new machines.

Now, I know what you're thinking, but let me assure you, I absolutely do not have OCD. If I had a penny for every time someone said they think I have OCD... I'd have 1,526 pennies.

Installation and usage instructions are on GitHub. It's free and open-source. Let me know if you have feedback or ideas!

2 Comments
2024/11/03
23:17 UTC

1

Looking for a DNS benchmark tool

A tool that allows me to benchmark the major DNS servers on the web (Cloudflare, DNS0, Quad9...). Something like dnsspeedtest.online.

Bonus points if it also allows you to benchmark different protocols: DNS over HTTPS, DNS over TLS, DNS over QUIC...

4 Comments
2024/11/03
14:33 UTC

0

Create a txt file from file name.

I can use - dir *.* /b >> list.txt But i need a txt file per file name, not a list of file in a txt folder.

Can anyone help?

8 Comments
2024/11/03
09:14 UTC

100

termfu - a multi-language debugger with custom layouts

https://github.com/jvalcher/termfu

Termfu is my take on a multi-language TUI debugger that allows you to create and switch between custom layouts. All window data is scrollable. Breakpoints and watchpoints persist between sessions. It currently supports GDB and PDB. Header command order, window size and position, (t)itle strings, and key bindings are customizable.

19 Comments
2024/11/03
01:42 UTC

0

Script to create your own network namespaces and bridge

2 Comments
2024/11/02
22:41 UTC

Back To Top