Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
For slackware 9 users trying to play cds in XMMS, you have to download and install the cdread plugin first ... its not installed with XMMS for some reason. I spent hours trying to figure this one out, only to find that it was something simple.
Has it ever happened to you that you accidentally used cat on a binary file and got your terminal full of weird characters? Well it happened to me, and I solved the problem with:
reset
which initializes your terminal.
I have some long files in my home, which I review frequently and instead of using:
less file
i add #!/usr/bin/less at the beginning of it, make it executable and run it.
Ever get tired of typing long directory names? Try using the directory stack with the commands pushd, popd, and dirs. The directory stack allows you to keep a list of directories and navigate between them.
# pushd adds a directory
# dirs lists all directories on the stack
# popd removes the top entry and cd's to that directory
Besides the one that is mentioned at the bottom of the man page for man (man man):
man man.page | col -b > man.page.txt
there is another way of extracting man pages into a file (suggested by UGU ):
first you have to set and export the variable PAGER to cat (for BASH):
export PAGER=/usr/bin/cat
then redirect the man page:
man man.page > man.page.txt
And at the end you must not forget to unset the variable:
unset PAGER
If your system mails you output from logrotation, maybe it's filtered tru Logwatch, logsurfer or the like, or maybe not. If your logs are huge and you're not sure you're eyeing all the "important" stuff, try piping it tru a filter. This example should work with any CLI mailreader that can work with pipes (I'm using Pine).
Save the file somewhere in your $PATH as "peg", make it executable. Open up Pine, pull up one of them logs, type pipe symbol, on the commandline type "peg", and enter.
Code:
#!/bin/bash
# Purpose: peg or "Pine Error Grepper"
# Args: none
# Deps: Bash, GNU utils
# Run from: pine as pipe filter
case "$1" in v|-v|r|-r|-rev|--reverse) rev="v";; esac
egrep -${rev}ie "(fatal|err|fail|warn|deny|denied|auth|kill|remov|exit|could|termin\
|signal|sync|sysrq|sudo|ignore | no | block | down | stop)"
exit 0
nb[0]: If you type "peg -v" you get the reverse, which is good to check on the grepping itself.
nb[1]: If your boxen usually do NOT have interfaces in promiscuous mode, then add "promisc" as a term to grep for.
nb[2]:If you use this filter, and you change/add something that could benefit us all, please post an update, TIA.
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629
Rep:
@lfur
(First method worked, but without the enhancements -- like bold text, underlined etc.)
The second does not: Firstly, my pager resides in /bin/cat (obstacle overcome ), but so the distros vary. The text in the newly created file then contains a lot of ?escape-sequences? like m^H, U^H etc.
My standard pager is "less". But "man <command> > output.file again lacks the enhancements.
Tested options, anybody? (less -isr??)
ab is the the apache bench command. It simulates 5 users(-c 5) accessing your site 200 times(-n 200). It takes a while to run but it spits out some very usefull information.
MasterC .... a great thanks to you. I was compiling the source code for my icewm and i so wished that there was a way around! And ahaa... here you go the good guys over here have done that... Thanks very much...
Having decided to say thanks, won't be fair if i don't do any of my the usual trick which i learnt in the due course... Excuse if someone has already done this over here. I jus' read the first 5 pages...
Ever wondered how to print a simple tex file( or in that whatever file..)
$> enscript file.tex -o file.ps -- u get a postscript file...
there are many options for enscript like 2(for two columns), E(for highlighting keywords in C,C++,...)...
still not happy with the ps, you can convert to the pdf as well...
$>ps2pdf file.ps
this is for starters... there are a lot of options for "ps2..." hope this helps some newbie...
Gotten tired of all the beeps your computer produces when you happen to hit backspace one time to many? I'm SOOO tired of this - a computer should be SILENT all the time unless I play something on it! So, what I did is to put the line "set nobeep" in my .cshrc (I'm using tcsh), and it is...silent! Great! Don't know if this works in bash though.
Do you have more hints on how to make the computer shut up?
I think editing inputrc to 'set bell-style none' will do it. I dunno - I don't mind the beeps - let's me know when I'm screwing up. Although I do need to change my mail-notification sound, since it's the same beep and that can be disconcerting. *g*
lol! Yeah, I think I'll try cutting the wire. Or not
Nah, I haven't found anything good with the beep, since it is often VERY obvious what the problem is. For instance, it's extremely obvious that I've "screwed up" when I bang the cursor into the prompt with an extra backspace
...but then again, it WOULD be nice to hear the beep when I get new mail
Great thread. Lots of neat stuff.
While reading the posts, I remembered some tricks that I use:
1. If you find pushd and popd cumbersome, you may be satisfied with just
cd -
It will get you to the previous directory. Then do it again to get back. It's like the recall button on the TV remote
2. Somebody mentioned having an alias like this:
alias server1='ssh me@server1.com'
Normally, when running this, you are asked for the password. You can get rid of this step as well by adding public key authentication. It's not very complicated, but you should understand what's happening, for obvious reasons. Instructions are found in man ssh and man ssh-keygen. Executive brief: run ssh-keygen on the client and update the file $HOME/.ssh/authorized_keys on the server.
3. An alternative command to find the 20 largest files in a directory tree:
du -aS /usr | sort -rn | head -20
(explanation: du -aS lists all files and their usage, excluding directories, sort -rn sorts the entries generated by du in reverse order based on file size, and head -20 displays only the top 20 lines returned by sort).
Originally posted by Cyclo Great feature of vim (heard there's something simliar in emacs) is folding, if you're a programmer.
You can collapse and expand sections of code you specify, handy if you have a function thats 300 lines long or something
works like this:
first, turn it on by typing ":set fdm=marker", then surround the bit you want to hide with:
//{{{ brief description here whatever you want to hide
//}}}
also works with:
/*{{{ brief descriptinon */ whatever
/*}}}*/
to hide or close a section, type "zo" to open, "zc" to close
If you're writing a bash script, where // doesn't work as a comment, you can replace // with a # and get the same result. Also, adding "set fdm=marker" to .vimrc will permanently enable this feature.
This is one of the best threads on LQ...thanks peeps.
i think this is awesome for most newbs even i understood a few things and i just installed red hat 8 for the first time 4 hours ago. ( i know don't ask me y) . I wish more people would go into a little more details about some of the simple commands and source code and give an explaination on termanology used in this thread. just giving my $0.000002
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.