Command Line

Subscribe to Command Line feed
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. Linux / BSD / OSX / Windows CLI apps or questions or comments, we're happy to take them all!Command Line
Updated: 15 min 44 sec ago

CLI only Debian VM

3 hours 40 min ago

I want to see just how far I can push my everyday computer use into the command line. I'm not a total noob when it comes to either linux or the command line, but I'm hopeless when it comes to building programs from source.

My questions are: How can I build vlc with framebuffer support, or should I stick with mplayer? What programs do you recommend? I've got irssi, screen, alpine, lynx, music on console, midnight commander, newsbeuter, rtorrent, vim and htop. Is it still possible to use irssi with facebook chat? And finally (for now), how can I get the menu based aptitude interface I know and love? I don't mind installing using only apt-get, but I like to be able to browse available packages to see if any tickle my fancy.

Thank you in advance to anyone willing to answer any of my questions.

submitted by /u/Spider_Gilgamesh
[link] [comments]

Grep listing every item on a new line?

14 hours 16 min ago

This extracts and lists all links from a file, but in notepad it doesn't list each link on a new line.

grep -o "http[^ ]*" input.txt > output.txt

You can also get links with Lynx, but it has the same problem.
lynx -dump -listonly -nonumbers "somesite.html" > output.txt

submitted by /u/PhiWeaver
[link] [comments]

Is there a way to prevent execution of an mp3 file?

Wed, 01/17/2018 - 21:20

I wanted a simple game for my little sister.

All but one .mp3 in a folder are locked. Inputting the correct name of the song in the terminal unlocks the next song until all songs are correctly guessed.

I've set up the dialogue and control structure of the game, but when I tried to "lock" the .mp3 files by using

chmod a-rwx filename

it doesn't actually prevent execution of the files (from system explorer) as I'd assumed.

Any suggestion much appreciated.

submitted by /u/senorinatta
[link] [comments]

How to install a CLI exe binary on Windows?

Wed, 01/17/2018 - 18:10

If I have a .exe Windows command line app binary, how should I install it? I know that on Linux or MacOS, putting the binary into the /usr/local/bin is all you need, so is there a similar solution on Windows?

submitted by /u/rumboogy
[link] [comments]

autostart helper for leight-weigh WM's

Wed, 01/17/2018 - 03:31

Hi command line,

I always had trouble managing my services and commands to autostart during an i3 session as well as properly git-ting it with my dotfiles. That's why I tried different approaches and finally came up with a little shell helper that separates logic and commands to start up making me independent of any WM.

It supports logging (stderr and stdout) as well as desktop notifications and the ability to define if it should be restarted or just making sure it is running. Both daemons and one-time commands can be hooked into it.

Could also be the case that there is already a well working and tested solution for that problem, so If you know of any better tools or have some criticism, please let me know.

https://github.com/cytopia/autorunner

submitted by /u/cytopia
[link] [comments]

Is it possible to run a set of unix commands behind a shortcut command?

Tue, 01/16/2018 - 22:52

Let's say there's a very specific command and set of parameters I want to use at a moment's notice, without having to type them all out. Is it possible for me to create a script of some kind that will run a Unix command (or maybe multiple commands) if I invoke it in the command line?

Or otherwise, is it possible to use hotkeys to open the terminal and run a script? What would be the best way of running a script with as little warning (or time) as possible?

submitted by /u/Anon30022
[link] [comments]

Help with move command

Tue, 01/16/2018 - 06:42

Hello all, im trying to create a bat file that will upload the contents of a directory to an FTP, and then move the text files to a backup directory within the same folder.

Im fairly new to the command line, so ive done some research and made some progress.

This will be given to a user to make the process of uploading the files as simple as possible, IE a single click or running the bat file using scheduled task.

They will always be text files, but the filenames will be slightly different each day. There will always be two files.

I have run into some issues that I cannot figure out with google.

At the moment I have a single bat file called "startupload.bat". This calls another batfile in the source directory called "fileup.bat".

Issue 1: In "startupload.bat" I navigate to the source directory, and then call fileup.bat to run on the text files using the command:

fileup.bat *.txt

But for some reason this will only move a single text file, not both. When I tried it yesterday both files moved but today, without changing anything, will only move one file.

Issue 2: Im also struggling with the move command. This is what im using:

move *.txt targetdirectory

The error I get is "cannot move multiple files to a single file."

I read that I can specify that the targetdirectory is an actual directory and not a file using the /D option - but when I try to use it I just get syntax errors - where should the /D option go?

If it helps, below is the full bat files that im using:

startupload.bat

pushd C:\Users\USERNAME\Documents\FTPAutoUploadTest\ mkdir Backups fileup.bat *.txt move *.txt C:\Users\USERNAME\Documents\FTPAutoUploadTest\Backups

fileup.bat

@echo off echo user USERNAME> ftpcmd.dat echp PASSWORD>> ftpcmd.dat echo bin>> ftpcmd.dat echo put %1>> ftpcmd.dat echo quit>> ftpcmd.dat ftp -n -s:ftpcmd.dat HOSTSERVER.com del ftpcmd.dat submitted by /u/ShockRampage
[link] [comments]

Show me your gpg.conf / gpg-agent.conf

Tue, 01/16/2018 - 03:09

Hi everybody,

I am currently trying to improve my gpg.conf and gpg-agent.conf for that I wanted to have a look at what other people have set.

I'd be happy if some of you could share your configurations or link me to their dotfiles.

Mine are:

gpg.conf:

use-agent utf8-strings auto-key-locate local

gpg-agent.conf:

default-cache-ttl 0 max-cache-ttl 0 pinentry-program /usr/bin/pinentry-x11 allow-loopback-pinentry

X-post gnupg, but I didn't receive any feedback yet.

submitted by /u/cytopia
[link] [comments]

Trying to connect mpd (ncmpcpp) to Philips Hue API to sync lighting with music playing

Mon, 01/15/2018 - 16:31

Not even sure if this is the best sub to ask this question but maybe somebody here has achieved this already.

submitted by /u/DonovanNagel
[link] [comments]

[Question] How to Remove Directory (rmdir)

Mon, 01/15/2018 - 12:36

Exercise 7: Remove Directory (rmdir) from Learning Python the Hard Way

This is my input. What am I doing wrong? Thanks for the help.

submitted by /u/JacobM00re
[link] [comments]

Unofficial Tidal CLI client

Sun, 01/14/2018 - 10:14

Hello, I use Tidal, an alternative to Spotify for music. I work on Arch Linux as my main OS and as you may know there is no dedicated Tidal client for it, but fortunatly I am a programmer and recently I made my own terminal-based Linux client for Tidal in NodeJS. Today I have finished one of the first versions of this app and I want to share it with you.

Here is my github page of it: Github link In readme you have all the information about installation and usage.

I'm asking You for feedback and maybe you can use it :) Thank you! John.

submitted by /u/okonek83
[link] [comments]

Adding jobs to a queue to be run consecutively

Sat, 01/13/2018 - 06:22

I've got a load of videos I need to encode and split into separate parts, which I do with ffmpeg via a python script and a file I feed into it for the timings.

Simplified version:

$ chop.py video.mp4 timings.txt

It takes a while to create the timings.txt files for each one as I have to look through the video for a good point to split. While I'm doing this, ffmpeg is churning away. All good.

But sometimes I don't see that the last video is finished and so my encoding machine is sat idle. I need a queue.

I've tried using the Linux 'at' command but I don't understand how it works and the man page isn't forthcoming. I added a load of jobs like this:

echo 'chop.py video.mp4 timings.txt' | at -q b now

The first one ran immediately. The subsequent ones showed up when I queried the queue with 'atq' command. But when job 1 finished, they did not run. They were still in the queue when I again checked atq, but have now just...disappeared.

Is there a better solution for me here? Or could someone help me to understand 'at'.

submitted by /u/hacksawjim
[link] [comments]

[Windows] change "Account lockout duration" policy via command line

Fri, 01/12/2018 - 11:45

Hi guys Im trying to change a number of non domain computers' account lockout policy from 1440 mins, down to 60. Policy is in "Computer Configuration\Windows Settings\Security Settings\Account Lockout Policy\Account lockout duration" Any help would be greatly appreciated.

submitted by /u/fupduk
[link] [comments]

[Question] Text Searching/Analysis for Phrases

Thu, 01/11/2018 - 13:43

Greetings — I have a book-length text file that I would like to automatically break down in larger chunks than words. I can do word frequencies and the like using various command-line tools, but what I'd like is a quick, command-line based way to identify and spit out all repeated 3 or 4 word series of words used.

For instance, if there were eight phrases of four words used more than once ("unix is not a"; "wonderful effects may be"), I would like them to be extracted without my having to identify them (if I'm doing that, hand-searching will do the trick) and spit them out to another file. I hope this is clear.

Thank you for any and all help!

submitted by /u/moonbatlord
[link] [comments]

Pages