Most Popular
1500 questions
76
votes
6 answers
View a range of bash history
The history command lists out all the history for the current session. Like:
1 ls
2 cd /root
3 mkdir something
4 cd something
5 touch afile
6 ls
7 cd ..
8 rm something/afile
9 cd ..
10 ls
11 history
In order to search items of interest, I can pipe…

Slartibartfast
- 863
76
votes
2 answers
How to Count the Number of Lines of an Output?
Let say I have the program:
Calculate.py
Is there a unix command-line that counts the number of lines outputted from my program, Calculate.py?

MEhsan
- 863
76
votes
10 answers
Can shell variable name include a hyphen or dash (-)?
I am not able to use - in variables in shell. Is there a way to be able to use it, because I have one script which depends on such named variables:
$export a-b=c
-bash: export: `a-b=c': not a valid identifier
$export a_b=c
First throws the given…

xyz
- 2,991
76
votes
5 answers
How to safely turn off swap permanently and reclaim the space? (on Debian Jessie)
I installed Debian Jessie with default partitioning on my SSD drive. My current disk partitioning looks like this:
As I have 16GB of RAM, I assume I don't need swap. But since I have other disk drives I may create a swapfile for example, on one of…

Vlastimil Burián
- 28,462
76
votes
3 answers
How does the "tail" command's "-f" parameter work?
$ tail -f testfile
the command is supposed to show the latest entries in the specified file, in real-time right? But that's not happening. Please correct me, if what I intend it to do is wrong...
I created a new file "aaa" and added a line of text…

its_me
- 13,959
76
votes
6 answers
Some M4 macros don't seem to be defined
I am trying reinstall pacman on my Arch Linux distribution. When I run the configure script "configure.ac", I get a bunch of undefined macros:
error: possibly undefined macro: AM_INIT_AUTOMAKE.
If this token and others are legitimate, please use…

SirTasty
- 903
76
votes
12 answers
How to convert TXT to PDF?
I want to convert .txt files to .pdf. I'm using this:
ls | while read ONELINE; do convert -density 400 "$ONELINE" "$(echo "$ONELINE" | sed 's/.txt/.pdf/g')"; done
But this produces one "error" -- if there's a very long line in the text file, it…

LanceBaynes
- 40,135
- 97
- 255
- 351
76
votes
8 answers
Who's got the other end of this unix socketpair?
I want to determine which process has the other end of a UNIX socket.
Specifically, I'm asking about one that was created with socketpair(), though the problem is the same for any UNIX socket.
I have a program parent which creates a…

Jonathon Reinhart
- 1,861
76
votes
5 answers
Adding unzipped files to a zipped folder
I'm trying to add unzipped files to an existing already zipped folder say new folder.zip. Is it possible to use zip -r new folder.zip after adding some unzipped files to them? Will this command compress the folder? Is there any alternative to do…

boo na
- 761
76
votes
2 answers
What does it mean to be "sh compatible"?
I've seen the phrase "sh compatible" used usually in reference to shells. I'm not sure if it also applies to the programs that might be run from within shells.
What does it mean for a shell or other program to be "sh compatible"? What would it mean…

Praxeolitic
- 1,668
76
votes
3 answers
How to restrict an SSH user to only allow SSH-tunneling?
How can I restrict a user on the SSH server to allow them only the privileges for SSH TUNNELING? i.e. So they cannot run commands even if they log in via SSH.
My Linux servers are Ubuntu 11.04 and OpenWrt.

LanceBaynes
- 40,135
- 97
- 255
- 351
76
votes
4 answers
How to delete old packages installed by pacman in Arch Linux?
I have recently installed Arch Linux and found that I am eating away at a lot of storage relatively quickly. For whatever reason I have already used 17GB in just about 2 weeks. I do not have a great deal of software installed so I am led to believe…

sherrellbc
- 2,501
76
votes
8 answers
Making zsh default shell without root access
I am using my school's computers and would like to use zsh instead of bash. I'd like to make it the default shell, but I cannot run a command such as $ chsh -s $(which zsh) because I don't have admin privileges.
Is there a way I can put something…

goodcow
- 913
76
votes
7 answers
On an Apple Keyboard under Linux, how do I make the Function keys work without the fn modifier key?
I use an Apple wired keyboard on Linux. By default the function keys (F1, F2, F3, etc) require the fn key to be pressed for them to work. Without the fn key, these keys control the features like Screen Brightness, Volume, and Music Track Control.
Is…

ryanlerch
- 925
76
votes
3 answers
What defines the maximum size for a command single argument?
I was under the impression that the maximum length of a single argument was not the problem here so much as the total size of the overall argument array plus the size of the environment, which is limited to ARG_MAX. Thus I thought that something…

Graeme
- 34,027