Most Popular
1500 questions
98
votes
2 answers
Which distributions have $HOME/.local/bin in $PATH?
For example, in Ubuntu, there is always a .local directory in the home directory and .profile includes this line:
PATH="$HOME/bin:$HOME/.local/bin:$PATH"
$HOME/.local/bin does not exist by default, but if it is created it's already in $PATH and…

Stoffe
- 1,083
98
votes
2 answers
Why is my bash prompt getting bugged when I browse the history?
Often when I start looking at history of commands some of the characters from a command displayed aren't erased, for example:
What's happening:
prompt$ some_command
prompt$ some_commanother_command
What should have happened:
prompt$…

korda
- 1,571
98
votes
2 answers
Shell Syntax: How to correctly use \ to break lines?
I used to believe that the appropriate way of breaking the lines in a list is
command1 && \
command2
It turned out that it isn't so , one doesn't need \
$ [ $(id -u) -eq 1000 ] &&
> echo…

Sergiy Kolodyazhnyy
- 16,527
98
votes
5 answers
Problem of Can't set locale; make sure $LC_* and $LANG are correct!
When I always try to install new package I get this message:
Can't set locale; make sure $LC_* and $LANG are correct!
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_GB:en",
LC_ALL…

Ismail Sensei
- 1,229
98
votes
1 answer
How to truncate text lines to N characters maximum?
Given a text file, or the output of a command, how can I truncate it so that every line longer than N characters (usually N=80 in a terminal) gets shorten to N characters maximum?

Totor
- 20,040
98
votes
15 answers
How to rsync files between two remotes?
I would like to transfer files between two remote hosts using on local shell, but it seems rsync doesn't support synchronisation if two remotes are specified as follow:
$ rsync -vuar host1:/var/www host2:/var/www
The source and destination cannot…

kenorb
- 20,988
98
votes
7 answers
How to use `which` on an aliased command?
Like most users, I have a bunch of aliases set up to give a default set of flags for frequently used programs. For instance,
alias vim='vim -X'
alias grep='grep -E'
alias ls='ls -G'
The problem is that if I want to use which to see where my…

Adrian Petrescu
- 1,087
98
votes
7 answers
Get common name (CN) from SSL certificate?
I have a SSL CRT file in PEM format. Is there a way that I can extract the common name (CN) from the certificate from the command line?

Naftuli Kay
- 39,676
97
votes
4 answers
How do I install htop in mac OS X?
How do I install htop for macOS (OS X)? (The easiest and laziest path)

Ruvenss
- 1,071
97
votes
4 answers
What is the meaning of 0.0.0.0 as a gateway?
Can anyone clarify gateway assignment for me?
What is the difference between adding a gateway as 0.0.0.0 and assigning a specific IP address as a gateway?

user2720323
- 3,589
97
votes
8 answers
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 date `1282367908'
$ date -d +1282367908
date:…

Umang
- 1,171
97
votes
9 answers
How can I check what signals a process is listening to?
How can I verify whether a running process will catch a signal, or ignore it, or block it? Ideally I'd like to see a list of signals, or at least not have to actually send the signal to check.

Jander
- 16,682
97
votes
7 answers
Move all files with a certain extension from multiple subdirectories into one directory
I have a bunch of .zip files in several directories:
Fol1/Fol2
Fol3
Fol4/Fol5
How would I do move them all to a common base folder?

InquilineKea
- 6,262
97
votes
5 answers
The result of ls * , ls ** and ls ***
I know using the command ls will list all the directories. But what does the ls * command do ? I used it and it just lists the directories. Does the star in front of ls mean how deep it will list the directories?

Andy M
- 1,083
97
votes
15 answers
Best way to search through shell's history
Is there a better way to search my history file for a command than grep? I do have some idea what the command starts as, but I don't know how far back in the history it is.
update: was formerly zsh specific but due to overlapping answers feel free…

xenoterracide
- 59,188
- 74
- 187
- 252