Most Popular
1500 questions
147
votes
11 answers
Script to change current directory (cd, pwd)
I want to run a script to simply change the current working directory:
#!/bin/bash
cd web/www/project
But, after I run it, the current pwd remains unchanged! How can I do that?

Sony Santos
- 1,573
- 2
- 10
- 7
147
votes
6 answers
What are other ways to share a tmux session between two users?
I'm looking for a clean and easy way to share a tmux session with another user on the same machine. I've tried the -S socket-path option, but it requires opening up all permissions of the socket-path before someone else can connect to the session. …

Ryan McGeary
- 1,575
146
votes
10 answers
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 is spawning?
I think I should have made myself…

Lazer
- 35,307
146
votes
11 answers
What is the difference between $* and $@?
Consider the following code:
foo () {
echo $*
}
bar () {
echo $@
}
foo 1 2 3 4
bar 1 2 3 4
It outputs:
1 2 3 4
1 2 3 4
I am using Ksh88, but I am interested in other common shells as well. If you happen to know any particularity for…

rahmu
- 20,023
146
votes
7 answers
tput setaf color table? How to determine color codes?
I am in the process of colorizing my terminal’s PS1.
I am setting color variables using tput; for example, here’s purple:
PURPLE=$(tput setaf 125)
Question:
How do I find the color codes (e.g. 125) of other colors?
Is there a color table…

mhulse
- 1,779
146
votes
7 answers
journalctl: how to prevent text from truncating in terminal
How can I keep long strings from truncating in terminal? For example if I run
journalctl -xn
There's a lot of text that I cannot read. I am open to using other programs/tools.

P.Brian.Mackey
- 1,791
145
votes
9 answers
What is the need for `fakeroot` command in linux
Why do we need fakeroot command at all? Can't we simply use the sudo or su commands?
The man page says:
fakeroot - run a command in an environment faking root privileges for file manipulation
About.com says:
Gives a fake root environment. This…

gkt
- 1,623
145
votes
9 answers
Which installed software packages use the most disk space on Debian?
Disk space on my root partition is running low, so I want to delete some applications from the system. How can I see which software packages use the most disk space? Is it possible to view that from aptitude?
I know about generic disk space…

Mirzhan Irkegulov
- 8,518
145
votes
4 answers
Cron vs systemd timers
It was recently pointed out to me that an alternative to cron exists, namely systemd timers.
However, I know nothing about systemd or systemd timers. I have only used cron.
There is a little discussion in the Arch Wiki. However, I'm looking for a…

Faheem Mitha
- 35,108
145
votes
7 answers
How do I clear the terminal History?
I am using Linux Mint 17.1 Rebecca for about 2 days and accidentally typed my password into the terminal which is now displayed in the history list of commands I have previously typed.
I want to clear the terminal history completely. I have tried…

Shambhala
- 1,553
145
votes
7 answers
How to kill a runaway cat?
Many times I accidentally run the cat command on files that have contents up to few thousand lines.
I try to kill the cat command with Ctrl+ C or Ctrl+Z, but both only take effect after the total output of cat is displayed in the terminal, so I have…

JigarGandhi
- 4,960
144
votes
6 answers
What is the purpose of the hash command?
If you run hash it shows the path of all commands run since the hash was last reset (hash -r)
[root@c04c ~]# hash
hash: hash table empty
[root@c04c ~]# whoami
root
[root@c04c ~]# hash
hits command
1 /usr/bin/whoami
[root@c04c ~]#…

spuder
- 18,053
144
votes
4 answers
What is the difference between "&&" and ";" when chaining commands
What is the difference between the following methods of chaining commands?
cmd1; cmd2
cmd1 && cmd2

varesa
- 2,396
144
votes
8 answers
Is there a tool to get the lines in one file that are not in another?
Is there any tool that can get lines which file A contains, but file B doesn't? I could make a little simple script with, e.g, perl, but if something like that already exists, I'll save my time from now on.

daisy
- 54,555
144
votes
1 answer
How to do a `tail -f` of log rotated files?
On a long running system I usually have a terminal with
$ tail -f /var/log/kern.log
or something like this open.
But from time to time I have to restart such command because no new messages are displayed anymore.
I assume this is because of the log…

maxschlepzig
- 57,532