The command-line is the interactive interface to your shell.

learn more… | top users | synonyms (1)

6
votes
4answers
5k views

All commands that should be used to connect to wifi in command line

I would like to switch from gnome to awesome and I would like to connect my wifi network in command line (instead of using gnome tools). So, I searched on the internet and found approximatively the ...
2
votes
3answers
526 views

Selective recursive move?

Is there a command like mv --preserve-structure src src/1 src/2/3 dst which creates dst/1 and dst/2/3? It should work similar to mv src/* dst, but move only the subtrees listed.
9
votes
2answers
981 views

What does “-” mean as an argument to a command?

I found this link on how to open tgz in one step. gzip -dc target.tar.gz | tar xf - What does the '-' mean?
4
votes
5answers
4k views

How can I logout from a graphical environment from the command line?

Part of the beauty of trying out alpha releases of operating systems is that things will break, including things we take for granted. Today it's the turn of the logout button. So, how do you log out ...
7
votes
1answer
347 views

Is there a way to make perl -i not clobber symlinks?

A friend of mine points out that if you do: perl -pi.bak -e 's/foo/bar/' somefile when "somefile" is actually a symlink, perl does just what the docs say it will do: It does this by renaming ...
3
votes
1answer
2k views

xmessage over ssh

The following command prints a message over ssh : xmessage Message -display :0 & How does it work? there is no -display option in xmessage's man page.
5
votes
2answers
1k views

Script for opening a file in an already existing emacs process

I keep emacs open all the time I'm working. I have several script that will launch all the apps and files related to a specific project. But, it will launch emacs again, rather than simply cause the ...
11
votes
4answers
16k views

What program do I use to check mail?

I'm receiving "You have mail" messages and according to How to remove “You have mail” welcome message I should read my mail with mail. However I cannot find the command in my system (Ubuntu 10.04 ...
28
votes
4answers
2k views

Is there a one-liner that allows me to create a directory and move into it at the same time?

I find myself repeating a lot of: mkdir longtitleproject cd longtitleproject Is there a way of doing it in one line without repeating the directory name? I'm on bash here.
30
votes
10answers
11k views

How do I reuse the last output from the command line?

This is a noob question, but I'd like to know how to reuse the last output from the console, ie: pv-3:method Xavier$ python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" ...
18
votes
1answer
1k views

Should the usage message go to stderr or stdout?

Should the usage message which is printed with e.g. command -? of a Unix command go to stderr or stdout, and why? Should it go to the same place if the user makes a mistake with an option?
6
votes
3answers
13k views

Getting all files that have been modified on a specific date

Is it possible to find all php files within a certain directory that have been modified on a certain date I'm using find /var/www/html/dir/ -mtime -28 | grep '\.php' to get files modified within ...
34
votes
3answers
13k views

What is the difference between Halt and Shutdown commands?

What is the difference between the halt and shutdown commands?
0
votes
3answers
4k views

Why $JAVA_HOME does not persist on a mac?

On my mac os 10.6.6 I'm trying to persist env variable $JAVA_HOME but it doesn't stick! $ export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home Once I restart it won't ...
4
votes
2answers
303 views

Relaunch application once finished

Is there a command that relaunch the application once it finishes from the command line? Letting you do something like: > relaunch python myapp.py If not, then what's my best option? I know I ...
2
votes
2answers
4k views

Converting text into ASCII/ISO-8859-1

I'm looking for some tool that can convert text, ideally from UTF-8 (but ISO-8859-2 and WINDOWS-1250 would be fine) into ASCII/ISO-8859-1? I have seen some online transliteration tools but I need ...
89
votes
13answers
33k views

How to have tail -f show colored output

I'd like to be able to tail the output of a server log file that has messages like: INFO SEVERE etc, and if it's SEVERE, show the line in red; if it's INFO, in green. What kind of alias can I ...
19
votes
3answers
815 views

Can other users view the arguments passed to a command?

If I invoke a command with arguments like so: bob@bob-pc:~$ command -arg1 -arg2 ...can other users view the arguments passed to the command?
3
votes
2answers
3k views

su vs su - (on Debian): why is PATH the same?

I know what should be the difference between su and su -, but in my system (debian testing) for example PATH is the same: [root]# su [root]# echo $PATH ...
8
votes
6answers
7k views

date, get current 15 minute interval

Is there any way I can get the current 15 minute interval using the date command or similar ? e.g. something like date %Y.%m.%d %H:%M will give me 2011.02.22 10:19 , I need something that yields ...
4
votes
3answers
457 views

Unix command that takes no arguments

Don't ask why, but is there a Unix command that takes no arguments?
8
votes
4answers
3k views

command to layout tab separated list nicely

Sometimes, I'm getting as an input tab separated list, which is not quite aligned, for instance var1 var2 var3 var_with_long_name_which_ruins_alignment var2 var3 Is there an easy way to render ...
2
votes
2answers
1k views

How to build a long command string?

I've a sequence of commands to be used along with lot of pipings, something like this: awk '{ if ($8 ~ "isad") {print $2, $5, "SE"} else {print $2, $5, "ANT"} }' ...
18
votes
10answers
6k views

Is there a robust command line tool for processing csv files?

I work with CSV files and sometimes need to quickly check the contents of a row or column from the command line. In many cases cut, head, tail, and friends will do the job; however, cut cannot easily ...
11
votes
2answers
2k views

IP to Country console command

Is there a console command that takes an IP address as an input and shows its geographical information like city, country, ISP, etc.?
11
votes
6answers
9k views

Deleting all files in a folder except files X, Y, and Z

I have a lot of files and folders in a specific folder and I want to delete all of them; however, I wanted to keep files X, Y, and Z. Is there a way I can do something like: rm * | but NOT grep | X ...
2
votes
1answer
2k views

Multiple “-bash command not found” messages in Mac OS X Snow Leopard Unix

When I open terminal I get an automatic error message -bash: PATH command not found. then I am stumped in getting multiple -bash "x" command not found. messages, even to simple commands such as ls cd ...
0
votes
1answer
85 views

Sources to learn about performing certain tasks on command line?

Can someone transform it into community wiki please? I guess I've got no privileges for that. Let's list practical sources for learning about performing certain tasks on *nix command line. E.g. I ...
10
votes
1answer
2k views

What does *~ mean?

At the end of a makefile I saw rm -f *~ *.class I understand the *.class, but what's *~?
5
votes
1answer
2k views

How to find files not of a certain type?

I'm trying to find out all of the different types of files in my unorganized music folder. I've been trying this command (to list files of types besides the ones I know are in there): find ...
5
votes
4answers
2k views

How can I check if a gzipped file is empty?

Is there a quick way to check if a gzipped file is empty, or do I have to unzip it first? example: $ touch foo $ if [ -s foo ]; then echo not empty; fi $ gzip foo $ if [ -s foo.gz ]; then echo not ...
25
votes
6answers
132k views

How do I zip/unzip on the unix command line?

How can I create and extract zip archives from the command line?
14
votes
2answers
8k views

Filtering invalid utf8

I have a text file in an unknown or mixed encoding. I want to see the lines that contain a byte sequence that is not valid UTF-8 (by piping the text file into some program). Equivalently, I want to ...
2
votes
2answers
3k views

Using an incrementing variable in a bash command line for loop?

I'm using a bash commandline for-loop to concat a group of files together, and I'd like to append an incrementing digit. Something like this: j=1;for i in *.bak; do echo {$j++: >> ...
8
votes
2answers
1k views

Simple CLI rss reader, that can print only subject and uri, based on new since time interval

So what I'm looking for is easy enough to code, but I'm wondering if it already exists, so I don't going releasing duplicate code. I need a feed reader, that prints the subject, and uri on one line, ...
4
votes
2answers
1k views

Implementing a Unix shell in C: Logging

I am currently working on implementing my own UNIX shell in C. The basis of the shell is working, you could find the source code here. Right now my next task is to implement a logging feature for the ...
2
votes
1answer
3k views

How do I reimage OpenWRT?

How do I reimage openwrt in such a way that all my settings will be lost. I've been having some issues, and I want to ensure that it's not a lingering setting, I want this to be a fresh install.
1
vote
1answer
858 views

What is the function/point of “config.sub”

I'm trying to install some software from the command line. There is a file called "config.sub". Am I supposed to use this for something? I haven't been able yet to find out by searching online ...
9
votes
4answers
3k views

Any options to replace GNU coreutils on Linux?

I've been thinking about discontinuing the use of GNU Coreutils on my Linux systems, but to be honest, unlike many other GNU components, I can't think of any alternatives (on Linux). What alternatives ...
10
votes
4answers
893 views

Why is echo “bar” -n different from echo -n “bar”?

Compare echo -n "bar" with echo "bar" -n The former does what I think it's supposed to do (prints "bar" without a newline), while the latter doesn't. Is this a bug or by design? Why is it ...
5
votes
3answers
9k views

How do I periodically run a command with very short intervall and get the return?

i need to call a specific command in an interval of about 5 sec. How would I setup a daemon/process running in the background or something similiar to do that? I looked at cronjobs, but the minimum ...
6
votes
2answers
5k views

How do I insert a space every four characters in a long line?

I've got a long line that I want to insert a space every 4 characters, on a single lone line of solid text to make it easier to read, what's the simplest way to do this? also I should be able to input ...
9
votes
1answer
603 views

Is there any env variable to turn --color (and the like) on for all commands?

I do use aliases to turn on color for some commands by default. But I'm wondering if there's an easier way at telling my system, color is supported, don't make me use --color for grep, ls, etc.
4
votes
2answers
2k views

wgetpaste alternatives?

Are there any wgetpaste alternatives?
10
votes
5answers
2k views

How do I recursively check permissions in reverse?

There's a command, I think it comes with apache, or is somehow related to it, that checks permissions, all the way down. So if I have /home/foo/bar/baz it will tell me what the permissions are for ...
13
votes
1answer
2k views

What protocol/standard is used by terminals?

I was wondering how the "GUI" of a command line application is communicated over a network. Most of the time, it's quite simple (plain text / input) but sometimes it's more complex (aptitude). Is it ...
-1
votes
2answers
4k views

How to delete a file in Arch console?

pacman stopped working and asked me to delete a file if "another package manager isn't working". What is the file for deleting files?
5
votes
2answers
5k views

Adding an empty line at the end of input

I have some command which produces output with no new line at the end, like this Myprompt$ somecmd dksfjdl dsfjdlkfj dsfjdkfj dfjdkfjMyprompt$ Currently I overcome this by somecmd | sed 's/$/\n/' | ...
159
votes
5answers
9k views

What's the difference between $(stuff) and `stuff`?

There are two syntaxes for command substitution: with dollar-parentheses and with backticks. Running top -p $(pidof init) and top -p `pidof init` gives the same output. Are these two ways of doing the ...
3
votes
1answer
5k views

cURL access HTTPS website

I trying to access the following site with cURL. (https://www.fleetagent.be) I have cURL configured with the following switches -L -k --proxy [username:password] I get the following error. What ...