Hot answers tagged

2 votes
Accepted

How to make bash script output compatible with both terminal and file?

Use test -t 1 or test -t 2 to test if (respectively) stdout or stderr is associated with a terminal. -t file_descriptor True if file descriptor number file_descriptor is open and is associated with a ...
Kamil Maciorowski's user avatar
1 vote
Accepted

Script to install Anaconda and update conda

Why are you using exec zsh? Why not use source ~/.zshrc instead? Like this: # Installing Anaconda if [ ! -d /opt/homebrew/Caskroom/anaconda ]; then brew install --cask anaconda; fi # This adds conda ...
Giacomo1968's user avatar
  • 54.4k
1 vote

Find files but exclude several directories?

exclude directories during find sudo find ~ -iname "*s40*" ! -path "*timeshift*" this command searches in the Home directory /home/username and finds files (or directories) ...
Phil Headford's user avatar
1 vote

Full command text with unix ps

As other answers have noted, piping the output to another command (e.g., less or more) or redirecting to a file will usually result in the terminal width being ignored. However, if that's not working, ...
jjlin's user avatar
  • 15.7k
1 vote

List open SSH tunnels

lsof -i shows the network connections associated with the ssh port. lsof -i:ssh or lsof -i:22 Sample output for two outgoing ssh tunnels: COMMAND PID USER FD TYPE DEVICE SIZE/...
user2314737's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible