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

learn more… | top users | synonyms (1)

13
votes
7answers
3k views

Isn't less just more?

When I do more filename and less filename, it would seem that the resulting terminals are quite similar. I can navigate and search through my files identically (j, Space, /pattern, etc.). I find it ...
13
votes
3answers
2k views

Why isn't there any shell command to create files?

Attention please: I am not asking how to make a file from the command line! I have been using touch for making files for years without paying attention that its main purpose is something else. If ...
13
votes
6answers
1k views

Can a Linux command have capital letter(s)?

Can a Linux command have capital letter(s)? I know it's supported but i want to be sure if it's a "problem" or considered "not a good thing"?
13
votes
3answers
1k views

Find out current working directory of a running process?

What command(s) can one use to find out the current working directory (CWD) of a running process? These would be commands you could use externally from the process.
13
votes
4answers
3k views

Why do some commands 'hang' the terminal until they've finished?

Sometimes you run a program from the terminal, say, lxpanel†. The terminal won't drop you back to the prompt, it'll hang. You can press Ctrl+C to get back to the prompt, but that will kill ...
13
votes
3answers
2k views

How to kill a process with a single command?

I want to kill a process, after finding the id in a single step. I currently use these two commands: pidof <name> kill <#number_which_is_result_of_command> How can I write a single ...
13
votes
7answers
5k views

diff within a line

I have some sql dumps that I am looking at the differences between. diff can obviously show me the difference between two lines, but I'm driving myself nuts trying to find which values in the long ...
13
votes
2answers
1k views

How can I count the number of different characters in a file?

I would need a program, that outputs the number of the different characters in a file. Example: > stats testfile ' ': 207 'e': 186 'n': 102 Exists any tool, that do this?
13
votes
3answers
5k views

Copy and paste a file/directory from command line

Instead of using the following command: cp {source file} {dest file} I want to be able to copy a file into the clipboard, and paste it somewhere else, in another directory. something like this: ...
13
votes
6answers
1k views

Text only mode in Linux (No Gnome, KDE, Unity) to prolong battery life

If I want to disable my GUIs completely to save battery life, how would I proceed? I know that I can hit Ctrl + Alt + F3 and be on the command line, but the desktop manager would be in the background ...
13
votes
2answers
5k views

Is it possible to save as sudo from nano after you've forgotten to run as sudo?

A lot of the time I edit a file with nano, try to save and get a permission error because I forgot to run it as sudo. Is there some quick way I can become sudo without having to re-open and re-edit ...
13
votes
4answers
12k views

How can I convert a PNG to a PDF in high quality so it's not blurry or fuzzy?

There are a lot of questions out there about how to convert a PDF file to a PNG image, but I'm looking to take a nice sharp PNG file and just basically wrap it or embed it in a PDF file without having ...
13
votes
2answers
867 views

Copying files from command line to clipboard

In a GUI file manager it is possible to select a few files, press Ctrl-C (which supposedly copies come info about the files to clipboard), then navigate to another folder and press Ctrl-V, which will ...
12
votes
6answers
633 views

Subtract 1 from all file names (rename them) in a directory.

I have a directory which contains image files with names like image1.jpg image2.jpg image3.jpg ... Unfortunately, the image names must be zero based, so image1.jpg should be image0.jpg, ...
12
votes
10answers
1k views

Where do I master the most useful linux commands for programmers? [closed]

The power of combining xargs, cut, tail, grep, seq, amazes me. What resource should I look at for a tutorial on the most useful linux commands for programmers? I'm interested in just the ones ...
12
votes
2answers
598 views

What is a simple way to schedule a single event to happen at some time in the future?

There are often times that I want my computer to do a single task, but not right now. For example, I could have it notify me in 30 minutes that it is time to leave work. Or maybe I want it to run a ...
12
votes
1answer
1k 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 ...
12
votes
3answers
1k views

How to stop a background process?

I have started a wget on remote machine in background using &. Suddenly it stops downloading. I want to stop its process, then start it again. How can I stop it? I haven't close its shell window. ...
12
votes
5answers
24k views

Is there a way to see details of all the threads that a process has in Linux?

For Windows, I think Process Explorer shows you all the threads under a process. Is there a similar command line utility for Linux that can show me details about all the threads a particular process ...
12
votes
4answers
10k 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 ...
12
votes
1answer
2k views

What are the differences between most, more and less?

I'm now using Arch Linux, and find a command most works like more and less. To understand the differences between them is a confusing problem. This Question has mentioned the differences between less ...
12
votes
2answers
1k views

Is there a way to intercept interprocess communication in Unix/Linux?

For intercepting/analyzing network traffic, we have a utility called Wireshark. Do we have a similar utility for intercepting all the interprocess communication between any two processes in ...
12
votes
4answers
5k views

How to Execute multiple command using nohup

I want to execute multiple command using nohup, And each command should execute after previous command, I used this command for example: nohup wget $url && wget $url2 > /dev/null ...
12
votes
1answer
4k views

ls taking long time in small directory

Running Ubuntu, I open a terminal and do sudo bash cd / ls | head -n 1000 And predictably about 20 directories are returned. However, if I do an ls, and don't pipe it into anything, the ls just ...
12
votes
1answer
7k views

How to remove a single line from history?

I'm working in Mac OSX, so I guess I'm using bash...? Sometimes I enter something that I don't want to be remembered in the history. How do I remove it?
12
votes
3answers
11k views

Is it possible to mount a gzip compressed dd image on the fly?

I like create an image backup for the first time I'm backing up a system. After this first time I use rsync to do incremental backups. My usual image backup is as follows: Mount and zero out the ...
12
votes
1answer
4k views

How do I find the window dimensions and position accurately?

I've been trying to figure out the size of a window for use in a small script. My current technique is using wmctrl -lG to find out the dimensions. However, the problem is this: The x and y figures ...
12
votes
2answers
241 views

`test` and `[` - different binaries, any difference?

I noticed while answering another question that test and [ are different binaries, but the [ manpage pulls up test's. Besides the requirement for an ending ], is there any difference? If not, why are ...
12
votes
2answers
2k views

How to invoke an Openoffice macro from the Linux command line

I have an OpenOfice macro that I want to use to process the contents of an OpenOffice file. I am able to do this by opening the file with OpenOffice and then running the macro. How do I invoke the ...
11
votes
5answers
4k views

What is the difference between ls and l?

I accidentally typed l instead of ls today and found that the command still printed a list of the files in my current directory. Trying l --help brings up the help file for ls suggesting that l is ...
11
votes
7answers
8k views

grep and tail -f?

Is it possible to do a tail -f (or similar) on a file, and grep it at the same time? I wouldn't mind other commands just looking for that kind of behavior.
11
votes
3answers
2k 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 ...
11
votes
4answers
5k views

How can I get a formatted date for a UNIX timestamp from the command line

I have a UNIX timestamp and I'd like to get a formatted date (like the output of date) corresponding to that timestamp. My attempts so far: $ date +%s 1282367908 $ date -d 1282367908 date: invalid ...
11
votes
3answers
2k views

how to download a file using just bash and nothing else (no curl, wget, perl, etc.)

I have a minimal headless *nix which does not have any command line utilities for downloading files (e.g. no curl, wget, etc). I only have bash. How can I download a file? Ideally, I would like a ...
11
votes
3answers
3k views

Break a large file into smaller pieces

How do I break a large, +4GB file into smaller files of about 500MB each. And how do I re-assemble them again to get the original file?
11
votes
3answers
13k views

How do I put a hat on 'e' (ê)?

Since I've migrated to linux a few years ago, one issue still remains. The ê character features a lot in my "moeder taal" (home language). In Windows making the character was easy, I simply had to ...
11
votes
4answers
1k views

Is it possible to configure ctrl-w (delete word)?

Normally, Ctrl-w deletes back to the last whitespace. Is it possible to configure it to use additional characters, such as /? Edit: To be more clear: I don't want to configure the key for it, I want ...
11
votes
1answer
749 views

zsh Interpret/ignore commands beginning with '#' as comments

In bash, if I type a command beginning with a '#', bash ignores it as a comment. Ie, the following is ignored at the bash prompt: > # Hi there! Whereas in zsh: > # Hi there ! zsh: bad ...
11
votes
5answers
1k views

Is there a good combination of command-line and graphical file browser?

Is there a feasible solution than combines the advantages of a command-line and a graphical file browser? For example, the command-line is good to change the directory and execute commands but can't ...
11
votes
1answer
13k views

How to use command line to change volume?

I am trying to control the volume using my programming script. How can I do the following in Fedora 15, Ubuntu linux? Mute/ Unmute Volume up and volume down Note: Please note that I use a web USB ...
11
votes
2answers
6k 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 ...
11
votes
3answers
3k views

Sunrise and other astronomical data from the command line

Is there a simple open-source, command-line program that can show the sunrise and sunset times at a given date and location, and perhaps moon and planet data as well? Browsing the Debian package ...
11
votes
4answers
2k views

Converting colored output into html

There are tools providing coloured output: dwdiff -c File1 File2 # word level diff grep --color=always # we all know this guy ... The question is: How to convert their colored output of arbitrary ...
11
votes
1answer
601 views

What do all the pictures on the front of the “Unix and Linux System Administration Handbook” represent?

I'm a newcomer to Unix and Linux, and I've been trying to get up to speed on everything. One of the guides I've used is the "Unix and Linux System Administration Handbook" It's a pretty great book, ...
10
votes
5answers
2k views

Delete 100 lines from vi editor using single command

I am using Ubuntu and trying to delete all 100 lines from vi editor but I got interview question of doing this in one command.
10
votes
4answers
792 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 ...
10
votes
8answers
9k views

What's the quickest way to add text to a file from the command line?

Occasionally I have a thought that I want to write into a file while I am at the terminal. I would want these notes all in the same file, just listed one after the other. I would also like a date / ...
10
votes
5answers
834 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 ...
10
votes
3answers
6k views

copy recursively except hidden directory

How do I copy recursively like cp -rf *, but excluding hidden directories (directories starting with .) and their contents?
10
votes
6answers
7k 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 ...