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

learn more… | top users | synonyms (1)

7
votes
4answers
5k views

How can I run a specific command for each find result?

How would one run a specific command for each file that was found by using the find command? For the purpose of the question lets say that I would simply like to delete each file found by find. I am ...
11
votes
3answers
3k views

How can I pipe output to another process, but retain the error state of the first process? [duplicate]

Possible Duplicate: Get exit code of process that's piped to another I am using the following command line (in a makefile) to pipe the verbose error messages from my compiler through a ...
-1
votes
2answers
3k views

clear tmpfs in my case

I am on a Ubuntu machine. I have make a directory under root directory, by: $ sudo mkdir /hello $ sudo mkdir /hello/bye Then I mount tmpfs with size 1024M to /hello/bye by: $ sudo echo "tmpfs ...
1
vote
3answers
146 views

Transferring access privileges from root to regular user

I log in to Ubuntu with the username student. There are some directories only the root user is allowed to access, for example /var/lib/mysql, (I know I can use sudo to access it but it is not what I ...
0
votes
1answer
6k views

Different ways of using expr command [closed]

I'm trying to learn the bash expr command inside and out. What are some of the most basic to the most creative/tricky/unexpected ways to use the expr command? Small, manageable examples are great.
1
vote
3answers
4k views

how to find out the ip of an ssh HostName

Is there a simple way to retrieve the IP of a HostName from an ssh config on the command line? Many times I have to use scp and would like to connect to a machine, but I remember only the HostName.
5
votes
2answers
5k views

Looking for a Java class in a set of JARs with find, unzip, grep

I was trying to find the JAR containing a Java Class. JARs are in zip format. My first attempt was: $ find -name "*3.0.6.RELEASE.jar" | xargs -l1 unzip -l \ | grep stereotype.Controller ...
1
vote
1answer
242 views

Empty typescript file with the script command

In the command line, I typed: script -a myfile Then, I typed the some standard commands. When I opened the myfile using vi, the file was empty. Why is that? And, also, any tips on using the ttyrec ...
8
votes
4answers
779 views

How can I get the most bang for my buck with the “diff” command?

I have tried using the linux diff command in the past without much luck or patience. I usually end up using a GUI utility like DiffMerge or Kdiff. Recently I started trying to use diff again to ...
1
vote
2answers
843 views

How can I make bash more readable? [closed]

As a linux user, I spend a lot of time mucking about in bash. I've always been a bit frustrated by how poor the readability is. Today this annoyed me enough to spur me into action. My immediate ...
7
votes
4answers
473 views

Capturing area of the screen without a Desktop Environment?

I'm running OpenSuse with dwm as a window manager. Since I made the switch from KDE, I haven't found a way to take a screenshot or even capture part of my screen. Is there a way I can do this in a ...
51
votes
6answers
6k views

When is xargs needed?

The xargs command always confuses me. Is there a general rule that can help me figure out when I need it? Consider the two examples below: $ \ls | grep Cases | less prints the files that match ...
1
vote
1answer
496 views

Create recovery medium from Windows 7 recovery partition

Many laptops are delivered with Windows 7 recovery partition (but without CD or DVD) which takes place on the harddrive that could contain some Linux distribution or serve for data storage. I don't ...
14
votes
2answers
4k views

How to execute consecutive commands from history?

Suppose I want to execute a sequence of four commands that I have executed before. If the first one is 432 in the command-history, then I could do: $ !432; !433; !434; !435 I'm curious, is there a ...
2
votes
2answers
9k views

Finding files containing certain strings under a directory [duplicate]

Possible Duplicate: How do I find text within a file and have it search multiple subfolders? I would like to find out all the files under mydir/ directory whose content contains the string ...
15
votes
4answers
18k views

What's the best way to join files again after splitting them?

If I have a large file and need to split it into 100 megabyte chunks I will do split -b 100m myImage.iso That usually give me something like xaa xab xac xad And to get them back together I have ...
2
votes
1answer
823 views

Changing gnome terminal transparency with a command in Ubuntu?

How can I change the transparency of the Terminal windows in Ubuntu with a command? I already know about the profile method but want a command so that I can quickly swap between transparent and ...
46
votes
3answers
2k views

Why is `--human-readable` needed and not default?

Several command line tools use the -h or --human-readable option to print file size in a human readable format (i.e., 36G vs 37550836). Why is this option needed and not the default? Aren't these ...
2
votes
2answers
794 views

How do I connect to a new wifi on the command line? [duplicate]

Possible Duplicate: All commands that should be used to connect to wifi in command line I don't need to configure my wifi card or anything. I just want to do the equivalent of a) listing ...
3
votes
4answers
1k views

Why can't I echo the password to fetchmail?

I'm trying to configure a fetchmail. Before I deal with the syntax of fetchmailrc ( I discovered that the level of bugginess of a problem is synergistic with the number of different aspects of the ...
2
votes
0answers
690 views

What good are the signs '-' (minus) in any Linux/UNIX commands? [duplicate]

Possible Duplicate: What does “--” (double-dash) mean? Single dashes - for single-character options, but double dashes -- for words? I was reading the man zip page and I found ...
19
votes
5answers
5k views

Command line friendly spreadsheets

Does such a thing exist? Text-based spreadsheets that display well in a CLI environment. I'm aware that I could cat foobar.csvand do as I please, but it isn't particularly practical or attractive. I ...
9
votes
3answers
688 views

How to pipe the list of commands displayed by of “tab complete”?

When using commands in bash I like the double tab option to display the available commands. Some commands have more possible matches than others: Is there a way I can pipe the output of the double ...
3
votes
2answers
798 views

Move with possible rename

Is it possible to construct a command that will move the file to another directory and if the same file is already there, generate some random string that is not in the name of some file in the ...
7
votes
1answer
16k views

Using --exclude with the du command

This is probably something basic but I'm not able to make it work. I'm trying to use DU to get a total size of files minus certain directories. I need to exclude one specific directory called uploads ...
2
votes
1answer
12k views

How to start nvidia x server settings from command line?

I am using Ubuntu 10.04, I know I can start NVIDIA x server settings by choose : System -> Preference -> Monitors on the top bar. But how can I start the NVIDIA x server settings window by run a ...
11
votes
5answers
1k views

Why does mkdir not have the -p flag set by default to allow for nested directory creation?

I see no reason why the -p flag on mkdir should not be set by default. -p, --parents no error if existing, make parent directories as needed It is a non-destructive command from what I can ...
4
votes
2answers
1k views

How to install light-weight vim and to be able to efficiently load files into one instance vim?

On my laptop with Ubuntu I'm able to have just one instance of vim, launched with vim --servername VIM After this I'm able to open files from console with vim --remote-silent filename I use ...
1
vote
1answer
187 views

How do I change the path used by the Gnome Command Line applet?

For my shell, I know that I have to modify .bashrc to add my ~/bin directory to the command path, but how do I get the Gnome Command Line applet to use that as a program location too? I'm using ...
5
votes
4answers
19k views

How can I embed subtitles into videos with ffmpeg?

I'm told it's possible to embed subtitles (.srt) into video files (.avi) using ffmpeg, but I can't find any mention of it in the man page. Is this possible? What command do I use?
6
votes
2answers
3k views

diff where lines are mostly the same but out of order?

I want to diff two sets of mod_rewrite rules. The set of lines are about 90% identical, but the order is so different that diff basically says they are completely different. How can I see which lines ...
2
votes
1answer
460 views

There is no bash indicator prompt after a forked process terminates

I am reading the book Advanced Programming in the Unix Environment. There is a test program to test the fork function. It works well in my Ubuntu. But what I confused is that why there is no command ...
1
vote
1answer
2k views

How to use bash control a keyboard

How to use bash command control a Keyboard. e.g. what is a command in bash for pressing ctrl+c, ctrl+l, etc..?
1
vote
2answers
148 views

How to change the interpret of a variable in `zsh`?

I set a variable TEMPP='-I ../dir1 -I ../dir2' then I run gcc -M $TEMPP somefile.c It seems not to include ../dir1 and ../dir2 in the search list of the include file, and if there is a space at the ...
12
votes
2answers
836 views

Manipulating X key and pointer grabs on the command line

What command line tools exist to list and manage X server grabs? (That's grab as in key and pointer grabs, i.e. restricting the use of a particular key or mouse button to a particular application, or ...
3
votes
2answers
2k views

How to refresh a window by terminal? Or how to simulate `F5`?

I would like a way to refresh a specific window by the terminal. Probably I will need a comand to find the id or the name of the window and a command to refresh it. It looks like xrefresh cannot do ...
4
votes
3answers
941 views

What's the best way to determine the working directory for UNIX process using 'ps'?

I am running a Ruby command line script (rufus.sh)which ultimately calls Thread.new, which spawns a UNIX process as shown below. I run this script for more than 1 directory as the output of the ps ...
5
votes
2answers
2k views

How to list files and directories with directories first

I have two questions. First, which command lists files and directories, but lists directories first? Second question: I want to copy a list of files into a single directory, but make the target ...
5
votes
4answers
501 views

How can I create a empty file whose name begins with a dash? [duplicate]

How can we create a empty file with the unix name -stuff. It means the name start with -. I tried with touch -stuff but it didn't work.
2
votes
1answer
531 views

Why does unlink(1) support only one file?

I'm used to commands supporting multiple filename arguments if possible, but unlink doesn't: %> unlink a b unlink: extra operand `b' Try `unlink --help' for more information. I ended up using a ...
9
votes
3answers
3k views

How to launch a set of program inside tmux or gnome-terminal within a script?

I wanted to launch a few commands simultaneously in tmux or gnome-terminal or xfterminal , every different tab with a single command running , and close that tab when that command finishes. Any ...
1
vote
2answers
2k views

regex find and replace 0x0D, 0x0A characters

I have a text file of a database dump with some line break characters (0x0A0x0D) in the middle of lines. I want to replace them with commas, but I can't do it simply, because those characters are the ...
2
votes
4answers
831 views

Can I pass files between commands?

I am looking for a way to send the resulting file from one comamnd to another, So I dont have to save a copy on disk inbetween. For example, if I have rared files on disk and want to open them I would ...
2
votes
2answers
5k views

extract middle section of lines of a text file?

I am writing a php script to parse a large text file do to database inserts from it. However on my host, the file is too large, and I hit the memory limit for php. The file has about 16,000 lines; I ...
10
votes
2answers
852 views

How to temporarily switch from ssh to my local shell?

I'm using cygwin. and use it with ssh to login into a ubuntu server. sometimes, I want to switch back to my cygwin and then quickly switch to ubuntu shell. How to do this?
8
votes
2answers
3k views

How to replace all the tabs in each file in a file system branch with 2 spaces each?

I code Scala and it's convention is to use double spaces per level for identiation. But using different editors makes my sources filled with a mix of spaces and tabs. I'd like to refactor all the ...
18
votes
6answers
64k views

How to connect to a serial port as simple as using SSH?

Is there a way to connect to a serial terminal just as you would do with SSH? There must be a simpler way than tools such as Minicom, like this $ serial /dev/ttyS0 I know I can cat the output ...
4
votes
3answers
1k views

Show lines matching a pattern and the 4 lines before each

For example, from this file: CREATE SYNONYM I801XS07 FOR I8010.I801XT07 * ERROR at line 1: ORA-00955: name is already used by an existing object CREATE SYNONYM I801XS07 FOR ...
6
votes
1answer
809 views

Find links and their positions in a PDF

I need to find all links in a PDF file, along with the page they're on and their X/Y position. Is there any tool or combination of tools I can use to do that?
11
votes
5answers
17k views

Linux ls to show only filename date and size

How can I use ls in linux to get a listing of filenames date and size only. I don't need to see the other info such as owner or permission. Is this possible?