The command-line is the interactive interface to your shell.
10
votes
1answer
3k 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 ...
10
votes
3answers
2k 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 ...
10
votes
4answers
353 views
In bash, what are potential negative consequences of pausing a process with control-z?
Using bash, one can pause a process with control-z. However, are there any general circumstances or guidelines to beware of where a process would not behave well with being paused?
My specific ...
10
votes
1answer
331 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
1answer
2k 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 ...
10
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 ...
9
votes
4answers
580 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 ...
9
votes
2answers
512 views
What languages are used to build Unix commands?
Examples of commands I'm referring to are ls, pwd, and cd. Also, how are these built? Do you have an example?
9
votes
6answers
3k 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 ...
9
votes
3answers
4k views
copy recursively except hidden directory
How do I copy recursively like cp -rf *, but excluding hidden directories (directories starting with .) and their contents?
9
votes
4answers
4k 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 ...
9
votes
4answers
1k views
How to shut down the computer after a task has been completed?
I usually start a download before I go to school.
Which command should I use to automatically make the necessary saves and turn off the computer after a particular task has been completed?
(Say, ...
9
votes
3answers
7k 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 ...
9
votes
1answer
6k views
What is the difference between modify and change in stat command context?
The stat command's manual page says:
%x Time of last access
%y Time of last modification
%z Time of last change
I am unable to understand what is the difference between ...
9
votes
3answers
11k 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 ...
9
votes
3answers
1k views
how to glob every hidden file except current and parent directory
I want to glob every hidden file and directory, but not the current (.) and parent directory (..).
I am using bash.
Observe current behaviour:
$ ls -a
. .. ...a ...aa ..a ..aa .a .aa .aaa ...
9
votes
2answers
258 views
Trying to “locate” and then open a file
Suppose that I have a file named filename123.txt and it is the single file that is named so, and I can locate it with the command locate filename123. And it returns only this file.
Now I want to open ...
9
votes
3answers
6k views
Set volume from terminal
Is it possible to set the audio volume using the terminal?, instead of clicking the speaker icon in the topbar, the reason I want need to do this is because my keyboard does not have a volume ...
9
votes
5answers
764 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 ...
9
votes
2answers
367 views
Remove all `at` jobs
I know that to remove a scheduled at job I have to use atrm "numjob1 numjob2", but is there an easy way to do that for all the jobs?
9
votes
4answers
617 views
Best method to collect a random sample from a collection of files
Suppose there is a directory holding 300 data files. I want to randomly select 200 of those files and move them into another directory. Is there a way to do that under Unix/Linux?
9
votes
5answers
1k views
Using text from previous commands' output
I know this is not how terminals work, but I find myself often wishing there was an easy way of using text (copying it, modifying it, etc) that is already on my terminal window history from some ...
9
votes
2answers
156 views
What are the characters printed when Alt+Arrow keys are pressed?
When I press AltUp, A printed to terminal screen. Same thing happened when I pressed AltDown but B is printed instead.
Other characters that I realized;
AltLeft = D and AltRight = C
What is the ...
9
votes
4answers
8k views
How to check password with Linux?
I want to check, from the linux command line, if a given cleartext password is the same of a crypted password on a /etc/shadow
(I need this to authenticate web users. I'm running an embedded linux.)
...
9
votes
4answers
2k views
How do I split a flac with a cue?
I've got a full album flac, and a cue file for it. How can I split this into a flac per track. I'm a KDE user, so I would prefer a KDE/QT way, I would like to see command line and other gui answer's ...
9
votes
4answers
1k 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 ...
8
votes
5answers
2k 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 ...
8
votes
5answers
389 views
What's the best way to take a segment out of a text file?
What's a good way of extracting say, lines 20 -45 out of a huge text file. Non-interactively of course!
8
votes
4answers
3k views
How to attach terminal to detached process?
I have detached a process from my terminal, like this:
$ process &
That terminal is now long closed, but process is still running and I want to send some commands to that process's stdin. Is ...
8
votes
2answers
2k views
When do su and sudo use different passwords?
I am able to run anything using sudo; my password is accepted. But whenever I try to do su from a shell, it fails with:
su: incorrect password
What can the problem be?
8
votes
3answers
6k 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?
8
votes
6answers
482 views
Best way run a command on each file in a directory tree
There appear be a number of ways to do this including loops in shell script, find and xargs. Which of these is best, and which is most portable?
8
votes
5answers
189 views
store command before pressing ctrl+c, revive afterwards [duplicate]
Sometimes I type a lengthy command in my command prompt and then notice that I need to check something before actually pressing return and executing the command. I press ctrl+c, execute the new ...
8
votes
2answers
310 views
Change directory without typing cd?
Is it possible to make bash change directory in command line simply by typing that directory without any commands like cd?
For example is it possible instead of writing this:
$ cd /tmp
I just want ...
8
votes
6answers
21k views
How do I make my pc speaker beep
Using bash, how can I make the pc speaker beep?
Something like echo 'beepsound' > /dev/pcspkr would be nice.
8
votes
4answers
365 views
rolling diffs for storage of highly similar files?
At work we do a nightly dump of our mysql databases. From day to day, I would guestimate that close to 90-95% of the data is duplicate, increasing as time goes on. ( Heck at this point some are ...
8
votes
2answers
673 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?
8
votes
3answers
213 views
How can my script know when I'm in a virtual console vs. an xterm?
A few of my scripts (keymap changing, public key adding) need to act differently when in a virtual console vs. in an xterm. What's the real code for
#!/bin/ksh
if [[ in_a_virtual_console ]]; then
...
8
votes
2answers
537 views
how to queue a command to run after another command finishes?
Sometimes I start a program that takes a very long time to finish (emerge), then realize that I should go to bed instead of waiting for it. If I know this in the first place I would run
program; halt
...
8
votes
4answers
1k views
'mv' equivalent of drag and drop with replace?
In a GUI environment, a drag-and-drop with replace will replace files and entire directories (including contents) with whatever is being copied in. Is there a way to accomplish this same intuitive ...
8
votes
2answers
1k 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 ...
8
votes
4answers
314 views
How do I shutdown, reboot and logout the system from the command-line?
I would like to do that using the command-line, because sometimes my computer freezes and I need to force a shutdown (I know it's not good to the hardware).
And: What is the difference between Halt ...
8
votes
1answer
424 views
How to run my own program without specifying its path
Let's suppose I have compiled something and I run it like so:
$ /path/to/my/executable/mycmd
Hello World
What do I need to do to run it like
$ mycmd
Hello World
from everywhere in my computer?
...
8
votes
4answers
7k views
Understanding the exclamation mark (!) in bash
I used
history | less
to get the lines of previous commands and from the numbers on the left hand side I found the line I wanted repeated (eg. 22) and did
!22
at the command prompt and it ...
8
votes
5answers
3k views
How do I merge two *.avi files into one
I have two *.avi files:
sequence1.avi
sequence2.avi
How do I merge these two files using a command-line or GUI?
8
votes
4answers
2k 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 ...
8
votes
1answer
208 views
Order of redirections
I don't quite understand how the computer reads this command.
cat file1 file2 1> file.txt 2>&1
If I understand, 2>&1 simply redirect Standard Error to Standard Output.
By that ...
8
votes
7answers
4k views
How do you bulk move files up one directory safely?
How can I move files up a directory where there might be hundreds or thousands of files in the directory, and you might not be sure about whether there are dupes in ... What method would you use?
How ...
8
votes
2answers
832 views
Clearing GNU Screen after full-screen application
When working at a normal xterm (not sure about a "real" terminal), when a full-screen program such as man or vim is closed, it disappears, leaving your screen so you can see your prompt, and previous ...
8
votes
3answers
474 views
Lowercasing all directories under a directory
I want to lowercase every directories' name under a directory. With which commands can I do that?