Ask Slashdot: Command Line Interfaces -- What Is Out There? 383
Mars729 writes "GUIs are walled gardens in that features available in one piece of software is not available to other pieces of software. However, there is software out there with command-line options that can make software features accessible to power users and programmers. Some important ones I have uncovered are:
- Exiftool: A command-line application that can read/write almost any kind of metadata contained in almost any filetype
- Imagemagick: This and similar software like GraphicsMagick is a full-feature toolkit for displaying, converting and editing image files.
- Irfanview: Like Imagemagick but faster, although it has much fewer features.
FFMpeg: For video files - VLC: For audio and video files
- Aspell: A command line spell checker
- Google Static Maps API: A URL with coordinates, markers, zoom levels and other options to show a custom map from Google Maps. (I just uncovered this: no need to learn KML!)
Less useful but still useful are command shells. These provide file management mostly. I believe some of them may allow for sending and retrieving email messages. Also useful but less accessible and with a steeper learning curve are software with APIs and scripting. Examples would be Visual Basic for Applications in office software and groovy scripting for Freeplane. What else is out there?"
systemd is there (Score:2, Informative)
You all will love to use
systemctl
journalctl
The first shows all services running on Linux
The last shows all binary logging on Linux
Get used to those commands because its the defacto standard now.
Re:What is this? (Score:5, Informative)
Re: What is this? (Score:3, Informative)
Your way of thinking needs an upgrade. Soon everyone needs to understand the concepts of systemd. That means your overall usage of grep, sed, awk, etc. will decrease. Wayland will bring another change in your life. Hope you welcome these. Oh I forgot, you won't be asked :)
PowerShell (Score:5, Informative)
PowerShell deserves a mention too. Some people hate it, some people love it.
It is object oriented so the data transfer between processes is more robust. Also all the commands' manual pages come with extensive documentation and lots of great examples. UNIX man pages usually lack examples.
Great topic (Score:5, Informative)
mulk - much needed modernization of wget's functionality :color ir_black
qrencode - copy-paste from the desktop to a mobile device, or maintain an airgap
iotop - like htop for IO
history - built into bash, re-issue old commands as !number
pkill - kill programs indiscriminately
youtube-dl - keeps working even though google has almost killed youtube
netstat -lnp - see which program is bound to which port
vim - it won't make sense until you install plugins like spf-13, learn a few key combinations and set
tar -zxvf - you can remember it because the keys are right next to each other
pxz - parallel LZMA compressor
alasamixer - volume control
locate - find files, update the index with updatedb
Looking forwards to see more!
Re:My head just exploded. (Score:2, Informative)
What I'm trying to understand, is how the submitter intends to use the CLI for a program without a shell of some kind. Unless he's talking about programs like Midnight Commander or Norton Commander (for people who really are getting old) by the term "command shells".
All that said, an interesting program is motion -- it lets you use a USB webcam as a motion detector, is scriptable, takes snapshots or movies.
http://www.lavrsen.dk/foswiki/bin/view/Motion/DownloadFiles [lavrsen.dk]
Re:What is this? (Score:5, Informative)
OP is just discovering the command line and finding out, that you can actually do almost anything with it.Don't bash his learning process (pun intended).
Take a webcam picture:
streamer -f jpeg -o image.jpg
Do magic with that picture:
convert image.jpg -colorspace Gray image_gray.jpg
And do check out rest of the ImageMagick:
http://www.imagemagick.org/ [imagemagick.org]
Re:What is this? (Score:5, Informative)
And if you happen to be using OS X, also check out sips(1) [apple.com]. It does much of what ImageMagick + DCRaw does, but a lot faster.
Re:CLI's Are Not Walled? (Score:5, Informative)
The best mix I ever saw was with Apple's MPW Commando interface. They had a unix like script language, but when you couldn't recall the special arcane syntax of some command, you could just hilite the command name and hit a key. A Commando dialog box came up formatted with radio buttons, checkboxes, etc. which recorded every dodad the command could use. Clicking and typing into the dialog fields built the text command for you in a pane at the bottom of the dialog box. When you were done, you could hit the run button or copy and paste the command into a command line window or paste it into a script you were building.
Comment removed (Score:4, Informative)
Re: systemd is there (Score:4, Informative)
You don't get a salary for educating the children. You get culture, pride, REAL security, population control, sustainable development... Just what am I listing here! You're a goddamaned idiot, aren't you? Admit it!
More CLI-Fu (Score:5, Informative)
Less useful but still useful are command shells. These provide file management mostly.
Ohhh, baby. If you think ImageMagick is cool by itself (and it is), just wait 'til you start to grok how powerful those "less useful" command shells are for gluing those complex tools together. It will blow your hair back.
Say you have a directory tree with a few hundred images scattered through it, and you want to create thumbnails for all of the images in a parallel directory structure; ImageMagick will do the thumbnail part, CLI-Fu will handle the directory traversal and turn a three hour job in to a three minute one.
Learn these for starters:
sed - text parser and transformer, for mutating file names and munging commands
awk - ultra-terse programming language, great for building more complex commands than you would with sed
find - traverse a directory tree and list files with conditional matching
xargs - process a large list of things (like files found with find) in batches
grep - filter out elements of a list based on string pattern matching
egrep - enhanced grep, includes more advanced patterns and wildcards
sort - sort lists numerically or alphabetically
wc - count the elements of a list, words in a line, or other things
wget - download a URL
curl - read a URL to stdout
Seriously, when you start piping those things together with the more complex command line tools like ImageMagick and FFMpeg, you will be astonished at the mass data processing you can do with a few dozen characters on the command line.
Re:PowerShell (Score:5, Informative)
It is object oriented so the data transfer between processes is more robust. Also all the commands' manual pages come with extensive documentation and lots of great examples. UNIX man pages usually lack examples.
Most bashers (no pun intended) miss several aspects of PowerShell simply because they view it as just another shell.
One such aspect is the fact that PowerShell is designed to operate directly with an application's core logic (the object model) whether that application was designed using COM or .NET. Virtually *all* of Window's features and even 3rd party applications for Windows are designed using one of those models. So the barrier to exposing the functionality to the CLI (PowerShell) is really, really low, and even older applications that predates PowerShell or that were never designed for PowerShell (like iTunes [powershell.com]) lend themselves to CLI manipulation. Forget about needing to craft a suite of external CLI tools - your app is inherently exposed to command line manipulation.
Another often overlooked aspect is how PowerShell is designed to run in-process within an application. The CLI is just *one* possible host for PowerShell. Alas, you can add the PowerShell engine to your app and immediately leverage existing commands to manipulate the in-process memory objects of your application. So not only is it *easy* to expose your application to automation, you can actually take advantage of the PowerShell engine to save work for your own in-application automation. With workflow engine integration in PowerShell 3.0 (it is now at 4.0) this is a great way to orchestrate workflows activities in an easy-to-manage way.
Re:New users don't know about CLI (Score:5, Informative)
New users never heard about bash. We live in the 21th century. By now no one should use things like grep, sed or awk anymore. The developers around systemd make sure that this functionality is soon hidden away from the audience.
Right, and that's the problem, new users don't understand how to use command line tools so everything gets loaded into a GUI like Excel or Access. We had a user insist that he had to have MS Access so he could process a big log file to extract a few records from it -- it was too big for Excel. He was a couple hours into figuring out how to get the file loaded into an Access table when someone asked me if I could help. 10 minutes after installing ActiveState Perl, I wrote a script to extract the records they needed, it ran for a couple hours to churn through over 100 gigabytes of data (limited by the speed of the fileserver), then after we had the data, I used a couple regular expressions to pull the data fields they needed out of a free form text field, and then 20 minutes later, used the data in the file to output the SQL commands that they needed to fix up the database (which is why they where looking through the file in the first place). They had originally planned on spending at least 3 days on this project. The Windows "find" command line took may have helped preprocess the file, but its lack of regular expression support would have meant running it dozens of times to get all of the data they needed.
Command line tools are still useful, even in the 21th century. If I didn't have Perl, then grep and/or awk would have been able to extract the data with a single pass through the file.