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

learn more… | top users | synonyms (1)

1
vote
2answers
87 views

Configure bash to execute command with last argument when no argument was provided

I would like to configure bash so that when I execute command (preferably from a list of commands, not any command) without an argument, it takes the argument of previous command. So, for example I ...
8
votes
4answers
20k views

Move all files with a certain extension from multiple subdirectories into one directory

Suppose I have a bunch of zip files in several directories: Fol1/Fol2 Fol3 Fol4/Fol5 And I want to move them all to a common base folder. How would I do this?
2
votes
1answer
3k views

How to monitor other nodes to get RSSI?

I need to measure RSSI between two peers of nodes in same network. If I have these two information: SSID for their network. IP for the target node to get the RSSI regarding it. So I found this ...
8
votes
1answer
7k views

How to get UUID for a USB drive?

I want to mount my USB to a mount point which holds the UUID name. But I don't know how to express this in a command line! Can someone help me how to do it? I have searched and found that I have to ...
2
votes
1answer
530 views

Grepping number in a file

I have this command $ cut -f2,3 AIS2F1 | grep [2-9][0-9]* | cut -f1 So my second and third fields are something like this Ben 434 Me 12 you 56 So, I thought that the logic should be to cut ...
2
votes
3answers
2k views

Why does Firefox refuse to die despite killing it with pkill -9?

I am issuing the following command to kill Firefox on my Red Hat Linux box: [subhrcho@slc04lyo ~]$ pkill -9 -f firefox [subhrcho@slc04lyo ~]$ However, when I try to invoke Firefox through ...
4
votes
2answers
188 views

printing .cpp file from command line using emacs

The goal is to print a set of *.cpp files on a network printer, but... in a way that the (color) printer prints the files like they appear in the c++ editor including the colors and highlighting. And ...
1
vote
1answer
48 views

Can one move a relpath in one command?

This question is similar to one I asked recently, but the answers to that question, for the most part, do not extend to this one, AFAICT. The main difference between the two questions is that the ...
2
votes
2answers
1k views

Can one copy a relpath in one command?

I find myself doing this often enough that I wonder if there's a standard Unix way to do it: % mkdir -p /TARGETDIR/relative/path/to % cp ./relative/path/to/somefile /TARGETDIR/relative/path/to In ...
19
votes
6answers
796 views

Why is aliasing over standard commands not recommended?

For example, a common alias I've seen in the ~/.bashrc file (or equivalents) is alias rm='rm -i' However, I've seen people recommend against this because the alias might not exist on another ...
0
votes
0answers
503 views

running matlab command line in screen — can't type after reattaching

I'm logging in via ssh to a more powerful computer, on this I start a screen session with screen -S mine and then open a matlab command line via matlab -nodesktop -nodplash and then run within matlab ...
5
votes
8answers
3k views

Run a command on all subfolders

If you have a series of subfolders (like from a to z) and want to run a command on each one of them (like rm *.pdf or ls *.pdf), how do you do that? The "manual" approach would be cd a, rm *.pdf, or ...
3
votes
2answers
373 views

Digging through huge gziped log files

From time to time I need to dig through huge log files (several GB unpacked) to debug a specific error. Now, vim is OK for browsing through the file, but when I need to find something in the file ...
19
votes
2answers
52k views

How to display open file descriptors but not using lsof command

Hi I have read Here that lsof is not an accurate way of getting the number of File Descriptors that are currently open. He recommended to use this command instead cat /proc/sys/fs/file-nr While ...
18
votes
3answers
20k views

How to cause kernel panic with a single command?

Is it possible to cause a kernel panic with a single command line? What would be the most straightforward such command for a sudoing user and what would it be for a regular user, if any? Scenarios ...
4
votes
3answers
695 views

Is a command's stdout to the terminal being logged?

I am interested in learning whether a command's output to the terminal is logged somewhere. Since that can be a bit too generic, what about cat (and ccat) in specific? If I use cat on a file, will ...
1
vote
3answers
173 views

Is there a linux distro, that is not installed, but runs from the browser?

I remember hearing about something similar. My constraints are: It may not be installed on the machine It may not be booted via USB or LiveCD What I need, in decreasing order of priority: 0. ...
1
vote
3answers
1k views

Splitting RGB raw file into 3 files, one for each channel?

I need to convert an RGB raw file into 3 files containing each the red, green and blue channel. I have not been able to find a UNIX command line to help me with this task.
0
votes
1answer
4k views

Cannot execute binary file on Mac OS X Lion 10.7.5

I want to execute phylocon on a mac OS X lion but after changing the path and making the file executable, I get the error 'cannot execute binary file'. But the steps that I took to running the command ...
18
votes
5answers
889 views

Difference between “. myscript” and “./myscript” [duplicate]

I am confused by "one only dot - space - shell script name" (like . myshellscript) and "path to shell script" (like ./myshellscript) commands. What for they are? I noticed the command . myshellscript ...
2
votes
1answer
1k views

NSLookup how to interpret output

Hi can someone help me to understand what this NSLOOKUP command's output [x]$ nslookup sample.abc.com Server: 161.43.32.162 Address: 161.43.32.162#53<-- ??? Name: sample.abc.com ...
2
votes
1answer
172 views

Is there a command line tool for validating RDF files?

I am looking for a substitution of the W3C RDF Validator, as it is broken, in addition I want something a bit more automated, such as a command line tool. I have been using xmllint for checking XML ...
0
votes
1answer
850 views

'ss' command for checking sockets not found

I get an error when I try to execute this command on Red Hat Linux. $ ss -s -bash: ss: command not found It is supposed to be for checking socket statistics. How do I execute this?
2
votes
3answers
527 views

Keeping program GUI front-end and CLI functionality separate

In Linux a lot of programs have a CLI version and a GUI front-end. I read somewhere that this follows the linux philosophy and is good practice. Of course it's true from a developers perspective to ...
2
votes
1answer
289 views

Simpler processing of shell script options

I'm looking for way to process shell script arguments that is cleaner and more "self documenting" than getopt/getopts. It would need to provide... Full support of long options with or without a ...
17
votes
6answers
8k views

How to display numbers in reverse order using seq(1)?

I have iterate over numbers in various order. I am able to display them in increasing order, even with steps like: $ seq --separator="," 1 10 1,2,3,4,5,6,7,8,9,10 $ seq --separator="," 1 2 10 ...
1
vote
1answer
619 views

Why is my mmv command not overwriting the files?

I have a batch file that, among other things, uses the command mmv to rename some files. The relevant line is like this: mmv "$BASEDIR/files/*.txt" "$BASEDIR/files/#1.strings" In essence it works, ...
1
vote
3answers
9k views

How to print the percentage of disk use from `df -hl`

I know that df -hl outputs a list of all my partitions with its size, usage as a percentage, and space available. If I wanted to output just the size and usage as a percentage of sda2 and sda3, for ...
2
votes
1answer
84 views

Message appears after every command completed

I am very new to Linux. Having said this, I had a friend go on my RHEL machine and he somehow added a few random lines in a file, which will post every time I have completed a command. I am not sure ...
5
votes
2answers
2k views

A command line utility to visualize how fast a file is growing?

I want to grok how fast a particular file is growing. I could do watch ls -l file And deduce this information from the rate of change. Is there something similar that would directly output the ...
0
votes
3answers
527 views

Limit find results in SSH

I using a line like this to search for a bunch of files: find . -name "page.php The results are hundreds of lines and I can't see it all. (I'm trying to just copy/paste it into excel to analyze ...
3
votes
1answer
2k views

Untar Without Top-Level Directory

I have a tar (websites.tgz) that contain a bunch of Drupal websites that are tarred up starting with 'htdocs' I need to untar them into /local/htdocs/web1 /local/htdocs/web2 and so on. But I ...
3
votes
8answers
3k views

grepping dotfiles with -R correctly?

From time to time I need to find a culprit in an unknown dotfile and instead of trying to figure out which package is to be blamed (e.g. xfce4 or thunar?) and what is their naming convention (.app vs ...
3
votes
5answers
253 views

Regex match in CLI

Is there something like a logical for the cli? I want to achieve this mv -t newfolder *.(png|jpg) so that alls jpg and png files are moved into newfolder. I know it could be done with mv -t ...
3
votes
5answers
5k views

Editing RTF files in text mode

I have a bunch of CLI-only computers (I have not bothered to set up a GUI yet). I'm comfortable enough in the CLI to not NEED a GUI for most things. However, as a student, turning in Plain-Text ...
3
votes
3answers
7k views

Determine whether a particular file is compressed

How to know in Linux whether a particular file is compressed or not using a command?
2
votes
3answers
950 views

Howto recursively create PDF thumnbails on linux command line

I am able to use ImageMagick to create a thumbnail of the first page of a PDF using: convert -thumbnail x80 95.pdf[0] thumb_95.png This works fine and generates a thumb_95.png file. I have tried ...
1
vote
6answers
4k views

Fast tool to generate thumbnail video galleries for command line

I use gframecatcher to generate thumbnail video galleries, i.e. something like this: However this is a GUI tool and I want to create recursively a gallery for every video in a directory structure, ...
1
vote
1answer
202 views

What does the number mean in a man page? [duplicate]

Possible Duplicate: What do the numbers in a man page mean? If I typeman ls, I seeLS(1) in the top left and top right corners of the manpage. I also see programs on the internet being ...
2
votes
4answers
12k views

How to send many commands to shell and wait for the command behind ends

Hello I have around 20 commands and I have to send all of this to Unix shell, and copy the result, but I don't know how to do it. I am not sure about what shell I have, because it is a small program ...
3
votes
2answers
7k views

How to use tail -f with grep to show surrounding lines

I would like to see the output in a logfile greped by only one domain but also the following two lines. Example: tail -f /var/log/apache2/modsec_audit.log |grep mydomain.de this shows all lines, ...
3
votes
2answers
501 views

Avoiding temporary files in zsh [duplicate]

Possible Duplicate: Shell programming, avoiding tempfiles Say I have the file data.txt, and the command cmd. cmd takes one argument, a file. Or, you could use stdin. Now, say data.txt is ...
1
vote
2answers
369 views

“watch” command not found in Cygwin? [duplicate]

Possible Duplicate: Cygwin has no watch command? I am in the process of learning Unix commands; I started a few days back. I read a post here and tried to use the watch command, but my ...
15
votes
5answers
23k views

User-friendly command to list all users on Ubuntu system?

Is there a user-friendly command I can use to list users in a console on an Ubuntu system? When I cat /etc/passwd I get a hard-to-read list of users. It would be nice to see an alphabetized list, ...
2
votes
2answers
640 views

View all user's printing jobs from the command line

I'm running Fedora 17, Gnome (3?), and using bash from terminal. Whenever I run lpstat I only get a list of my jobs, but every time I go to retrieve my jobs from the printer, somebody else is ...
9
votes
4answers
2k views

Compute average file size

I am looking for a handy one-liner for computing the average file size in a directory. What I want is: size of all files / number of files in directory
2
votes
1answer
474 views

Help me parse this `find` command

Following command tells me the length of mp4 video files: find -type f -name "*.mp4" -print0 | \ xargs -0 mplayer -vo dummy -ao dummy -identify 2>/dev/null | \ perl -nle ...
3
votes
3answers
698 views

Averaging output of dstat

I need to average upload and download speed using dstat -n. How can I add all the received and sent data sizes that appear after dstat -n, so that I can add them and find average upload and download ...
2
votes
1answer
210 views

How can I remaster a text-based linux distro?

So I have a Ubuntu minimal install, it is exactly the way I want it when I want to have a fresh install, with the included settings, packages, etc. It has no desktop, it is completely CLI. What is ...
3
votes
2answers
563 views

Please explain the -f option in pgrep

man pgrep says the following about -f option: -f The pattern is normally only matched against the process name. When -f is set, the full command line is used. What does it ...