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

learn more… | top users | synonyms (1)

16
votes
9answers
1k views

How to make sure that a command is not interrupted, even if terminal is closed? [duplicate]

In Linux. Say I want to run a command and it takes too long. I just want to ensure it's done. How?
16
votes
6answers
714 views

How to type several file names with fewer key strokes

If I want to convert a pdf to a png image with imagemagick I do something like: convert -trim -density 400 this_is_a_very_long_filename_of_my_pdf_file.pdf ...
16
votes
6answers
2k views

Why do I have to cd out of a deleted directory?

On my server I have a directory structure looking something like this: /myproject/code I normally have an ssh connection to the server and 'stand' in that directory: root@machine:/myproject/code# ...
16
votes
10answers
11k views

What's a good example of piping commands together?

If you were helping someone to learn the concept of pipes on the command line what example would you use? The example that actually came up was as follows: cat whatever.txt | less I feel like ...
16
votes
7answers
703 views

How to efficiently generate large, uniformly distributed, random integers in bash?

I have been wondering what would be the best way to get good randomness in bash, i.e., what would be a procedure to get a random positive integer between MIN and MAX such that The range can be ...
16
votes
2answers
468 views

How to retrieve lost aliases?

Let me start by saying I know this was dumb. Time and Linux make fools of us all. I made an echo command to my .bash_aliases file and erased all of my aliases, except the test alias. However, I ...
16
votes
6answers
2k views

put history command onto command line without executing it

I use !n where (n) is the line number for executing a line in the history file I want executed at the command prompt which I find via history|less. But there is a command line history event I wish ...
16
votes
3answers
18k views

How can I use ffmpeg to split MPEG video into 10 minute chunks for YouTube upload?

There is often a need in the open source or active developer community to publish large video segments online. (Meet-up videos, campouts, tech talks...) Being that I am a developer and not a ...
16
votes
2answers
1k views

Is it harmful to close a terminal window without properly exiting an application?

Using Ubuntu 12.04 LTS, my question is that if I started an application in a terminal window, then is there anything bad about just closing the terminal window without exiting the application properly ...
16
votes
3answers
872 views

Copy image from command-line to clipboard

Is there a way in a bash to copy a picture to the clipboard? For example if there is a picture mypic.png I want to have a command like clipcopy mypic.png such that I can go for example to inkscape ...
16
votes
1answer
2k views

copy (to X clipboard) shortcut in .tmux.conf

In order to copy text to X clipboard in tmux, what I currently do is: go selection mode with prefix[ start selection with space (using mode-keys vi btw) select the text and press enter copy tmux ...
15
votes
6answers
4k 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 ...
15
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 ...
15
votes
2answers
8k views

How to Determine the Amount of RAM Slots In Use?

I forgot how many RAM modules are installed on my laptop. I do not want to unscrew it but want to look it up on the console. How do I gather this information?
15
votes
4answers
16k 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 ...
15
votes
1answer
457 views

Make program first read from pipe, then from keyboard

Consider the interactive program interactive. I have to run this program fairly frequently, and each time I run it the first few commands are the same. Obviously, having to type those commands over ...
15
votes
1answer
7k views

What do double slashes mean in UNIX path? Is `cd dir/subdir//` valid? [duplicate]

Possible Duplicate: How linux handles multiple path separators (/home////username///file) Do cd dir/subdir/ and cd dir/subdir// mean the same in UNIX? Will the later work out? Else does ...
14
votes
2answers
1k views

Accidently created a file called -X, how can I delete it? [duplicate]

Possible Duplicate: How do I delete a file whose name begins with “-” (hyphen a.k.a. dash or minus)? Like an idiot, I ran this command: tar -cf -X awstats-icon icon ...
14
votes
5answers
6k 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 ...
14
votes
4answers
22k 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. ...
14
votes
4answers
4k 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 ...
14
votes
3answers
4k 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 ...
14
votes
3answers
9k 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: ...
14
votes
4answers
4k 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 ...
14
votes
2answers
2k 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?
14
votes
1answer
1k 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 ...
14
votes
2answers
9k 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 ...
14
votes
3answers
3k views

Command for forcing a pointer ungrab (captured mouse release)

Sometimes Firefox doesn't release the mouse after dragging, so I need to kill the application to force it to release its pointer grab. Is there any command to force an application to ungrab the ...
14
votes
1answer
310 views

Is there a way to search manpages for typical use scenario?

I have a relatively small brain, so there is a limit to what I can store up there. I have been using Linux semi-pro-amateur for a few years and still I am amazed at how little commands I know. Simple ...
14
votes
3answers
5k views

How do I find the window dimensions and position accurately including decorations?

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 ...
14
votes
2answers
1k 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 ...
13
votes
6answers
13k views

How can I display the contents of a text file on the command line?

I would like to display the contents of a text file on the command line. The file only contains 5-6 characters. Is there an easy way to do this?
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
2answers
669 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 ...
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 ...
13
votes
4answers
7k 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 ...
13
votes
3answers
9k 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 ...
13
votes
7answers
7k 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
3answers
5k 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?
13
votes
2answers
2k 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 ...
13
votes
3answers
1k views

How can I keep control+d from disconnecting my session?

I regularly ssh to a centos 5 box. Somehow they keys are mapped so that control+d will log me out of my current shell. If I am sudo'ed to another use it puts me back to the previous user. If I am not ...
13
votes
6answers
2k 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
1answer
19k 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 ...
13
votes
2answers
3k 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 ...
12
votes
5answers
8k 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.
12
votes
4answers
64k views

How to determine Linux kernel architecture?

uname -m gives i686 and uname -m gives i686 i386 output in Red Hat Enterprise Linux Server release 5.4 (Tikanga) machine. I need to install Oracle Database 10g Release 2 on that machine. So, how can I ...
12
votes
6answers
890 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
12k views

How to signal the end of stdin input in bash

In Bash, I learned that the ending signal can be changed by here document. But by default how can I signal the end of stdin input? I happened to find that with cat and chardet, their stdin inputs can ...
12
votes
9answers
3k views

Console Text Editor with Windows-like keyboard shortcuts (ctrl-z, x, c, v)

Ok, I realise that I risk a religious war asking a question about text editors, but here goes. Requirements Mostly used for config file edits Text based not GUI Available for Raspian flavour of ...