Commands tagged unset (2)

  • One of my favorite ways to impress newbies (and old hats) to the power of the shell, is to give them an incredibly colorful and amazing version of the top command that runs once upon login, just like running fortune on login. It's pretty sweet believe me, just add this one-liner to your ~/.bash_profile -- and of course you can set the height to be anything, from 1 line to 1000! G=$(stty -g);stty rows $((${LINES:-50}/2));top -n1; stty $G;unset G Doesn't take more than the below toprc file I've added below, and you get all 4 top windows showing output at the same time.. each with a different color scheme, and each showing different info. Each window would normally take up 1/4th of your screen when run like that - TOP is designed as a full screen program. But here's where you might learn something new today on this great site.. By using the stty command to change the terminals internal understanding of the size of your terminal window, you force top to also think that way as well. # save the correct settings to G var. G=$(stty -g) # change the number of rows to half the actual amount, or 50 otherwise stty rows $((${LINES:-50}/2)) # run top non-interactively for 1 second, the output stays on the screen (half at least) top -n1 # reset the terminal back to the correct values, and clean up after yourself stty $G;unset G This trick from my [ bash_profile ], though the online version will be updated soon. Just think what else you could run like this! Note 1: I had to edit the toprc file out due to this site can't handle that (uploads/including code). So you can grab it from [ my site ] Note 2: I had to come back and edit again because the links weren't being correctly parsed Show Sample Output

    G=$(stty -g);stty rows $((${LINES:-50}/2));top -n1; stty $G;unset G
    AskApache · 2010-04-22 18:52:49 1

  • 0
    eval "unset $(printenv | grep -ioP '(?:https?|no)_proxy' | tr '\n' ' ')"
    acavagni · 2019-06-28 10:40:41 0

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Check These Out

Kill all processes that don't belong to root/force logoff
explanation: grep -- displays process ids -v -- negates the matching, displays all but what is specified in the other options -u -- specifies the user to display, or in this case negate The process loops through all PIDs that are found by pgrep, then orders a forced kill to the processes in numerical order, effectively killing the parent processes first including the shells in use which will force the users to logout. Tested on Slackware Linux 12.2 and Slackware-current

uniq without pre-sorting
Reads stdin, and outputs each line only once - without sorting ahead of time. This does use more memory than your system's sort utility.

list block devices
Shows all block devices in a tree with descruptions of what they are.

Server load and process monitoring
In certain cases you mighy need to monitor the server load caused by certain process. For example HTTP, while stress testing apache using ab (apache benchmark) you may want to monitor the server status,load, # of spawned HTTP processes, # of established connections, # of connections in close wait state, apache memory footprint etc.

Rename files in batch

Change pidgin status
Thanks for the comment oshazard, i wasn't aware of purple-remote existence.

List all directories only.
Undocumented syntax, but should work on every shell. It'll list all directories in the current one. Change `*/` into globbing `**/` for recursivity.

copy paste multiple binary files
Useful when you have multiple files or binary files that you need to transfer to a different host and scp or the like is unavailable. To unpack on the destination host copy paste output using the opposite order: openssl enc -d -base64 | gunzip | tar -x Terminate openssl input using ^d Note: gzip is outside of tar because using -z in tar produces lots of extra padding.

Suppress output of loud commands you don't want to hear from

1+2-3+4-5+6-7 Series

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: