VectorLinux

Please login or register.

Login with username, password and session length
Advanced search  

News:

Visit our home page for VL info. For support and documentation, visit the Vector Linux Knowledge Center or search the Knowledge Center and this Forum using the search box above.

Pages: 1 [2]

Author Topic: Post your favorite shell commands!  (Read 4569 times)

GrannyGeek

  • Packager
  • Vectorian
  • ****
  • Posts: 2567
Re: Post your favorite shell commands!
« Reply #15 on: August 25, 2009, 06:57:11 pm »

xkill is my last choice for shutting down a program. The reason is that often there are processes from the program still running if you've stopped it with xkill.

I prefer to kill processes. If I'm able to open a terminal, I type
ps -e
to see what processes are running. Then I try
kill ****
(**** being replaced by the process number). If the process won't quit, I try
kill -9 ****

That usually does it. There is also a
killall nameof process
but I haven't had much luck with it. I'm probably doing something wrong, but I'm not that enamored with the intricacies of commands, so I stick with what works for me (kill or kill -9).

If I can't open a terminal, I try to open another console with the control+alt+F2 command. Then I run ps -e in that console and see if I can get rid of the offending processes. Control+alt+F7 takes me back to my GUI desktop.
--GrannyGeek
Logged
Registered Linux User #397786

Happily running VL 7 Gold on  a Sempron LE-1300 desktop (2.3 GHz), 4 G RAM,  GeForce 6150 SE onboard graphics and on an HP Pavilion dv7 i7, 6 gigs, Intel 2nd Generation Integrated Graphics Controller

rbistolfi

  • Packager
  • Vectorian
  • ****
  • Posts: 2305
Re: Post your favorite shell commands!
« Reply #16 on: August 26, 2009, 07:23:10 am »

Please make sure you include either a description of the command or a reference link to explain the command. I'm thinking of newbies here who might find these commands useful but might not know what they do or how to use them.

I cheated a bit, because the find command can be used in combination with any other.

you can use it like this for example:

find /home/rbistolfi/ -name "*.txt"

And it will return all the files ending in "txt" under my home folder.
Recently I made a mistake while compiling Xfce4 and I missed a version number for one of its deps in several SlackBuilds. You can use find to fix stuff like that:

find /opt/chroot6.0/root/xfce4 -name "*.SlackBuild" -exec sed -i 's/foo/bar/g' {} \;

The -exec  command executes the rest of the string through the shell, until '\;'. '{}' is a wildcard for the found file name.
I use it for building playlists sometimes ;D

find /home/rbistolfi/music -name "Nirvana*mp3" -exec mplayer {} \;
Logged
"There is a concept which corrupts and upsets all others. I refer not to Evil, whose limited realm is that of ethics; I refer to the infinite."
Jorge Luis Borges, Avatars of the Tortoise.

--
Jumalauta!!

The Headacher

  • Louder than you
  • Global Moderator
  • Vectorian
  • *****
  • Posts: 1553
  • I like the bass to go BOOM!
    • Multimedia on VL (work in progress)
Re: Post your favorite shell commands!
« Reply #17 on: August 26, 2009, 12:11:47 pm »

Code: [Select]
man <command>
to read all about the commands that people didn't say what they were for :).

Also, for programmers, man pages are invaluable. For instance, a lot of c functions have man pages, the same for perl (as I recently found out), and if you do shell scripting, try

Code: [Select]
man bash
Logged
Most music on my soundcloud page was arranged in programs running on VL.

kidd

  • Packager
  • Vectorian
  • ****
  • Posts: 682
Re: Post your favorite shell commands!
« Reply #18 on: August 31, 2009, 01:10:54 am »

Code: [Select]
man <command>
to read all about the commands that people didn't say what they were for :).

Also, for programmers, man pages are invaluable. For instance, a lot of c functions have man pages, the same for perl (as I recently found out), and if you do shell scripting, try

Code: [Select]
man bash

TheHeadacher++ .  Man pages are priceless. 

For perl programmers:

Better than man (it doesn't always find what you want), use perldoc.

perldoc Module   (perldoc Storable)
perldoc -f function  (perldoc -f split)
perldoc -q FAQKeyword (perldoc -q random)

You can use tab completion to have a quick general view of what's available.

more info in .... yes you guessed it

Code: [Select]
man perldoc

Triarius Fidelis

  • Vecteloper
  • Vectorian
  • ****
  • Posts: 2399
  • Domine, exaudi vocem meam
    • my website
Re: Post your favorite shell commands!
« Reply #19 on: September 04, 2009, 05:45:38 pm »

echo 'Ah, ah, ah! You didn't say the magic word!' && yes 'Ah, ah, ah!'
Logged
"Leatherface, you BITCH! Ho Chi Minh, hah hah hah!"

Formerly known as "Epic Fail Guy" and "Döden" in recent months

Pita

  • Vectorian
  • ****
  • Posts: 1332
Re: Post your favorite shell commands!
« Reply #20 on: September 04, 2009, 07:18:50 pm »

Some more aliases:

alias rm="/usr/bin/safedelete -i"
alias h='history | grep $1'
alias ll='ls -l'
alias man="man -P more"

Of which the first 3 I used most and love 'h'. Safedelete is an old program to
safely delete files. Can be retrieved again after deletion for a given period of time.

That would work as well:
# alias rm='mv --target-directory=/home/peter/.trash $1'

I have to add, if one has done a history|grep the history is listed with its corresponding numers.
Then one just has to enter "!number" like !452 for example and that command will
be executed. Fast and easy. Recently I had to manually enter the sound modules
about 20 of them. h snd would list the ones I had entered the first time then it was
just a matter of entering one number after the other with !.
« Last Edit: September 07, 2009, 12:33:40 am by Pita »
Logged

Freston

  • Vectorite
  • ***
  • Posts: 165
Re: Post your favorite shell commands!
« Reply #21 on: September 08, 2009, 11:44:49 am »

`alias` is a very good command. useful for anything.

The command I got most excited about when I learned about them where pdftotext and doc2txt. Just so you can unleash the full might of grep, sed, awk and ye olde cut on document formats that are not otherwise friendly to the command line natives.

Another one I find most useful is `apropos`, for when you know what you want to do, but not the name of the command that does it.

But the most geeky command in my arsenal most be *drumroll* `VBoxHeadless --startvm spoednix`
-- where 'spoednix' is the name of the virtual machine you want to say 'power on' to.


Quote from: bigpaws
Is there anything better than cat?
Nope. Nothing beats cat. Almost nothing. I use it more often than `cd` or `ls` even:
Code: [Select]
history|awk '{print $2}'|sort|uniq -c|egrep cat\|cd\|ls|sort -r
     26 cat
     16 ls
      8 cd
Logged

Pita

  • Vectorian
  • ****
  • Posts: 1332
Re: Post your favorite shell commands!
« Reply #22 on: September 09, 2009, 02:36:58 am »

I like that even so its gawk to me. Here is mine:

32 cd   
22 locate
20 cat
18 ls
Logged

kidd

  • Packager
  • Vectorian
  • ****
  • Posts: 682
Re: Post your favorite shell commands!
« Reply #23 on: September 09, 2009, 04:43:04 pm »

lftp is one of those little programs that change the way you look at some task.

It's an advanced ftp/scp/sftp console program with multitude of options.

Here's how it made my day today:  http://puntoblogspot.blogspot.com/2009/09/lftp-i-love-you.html

It's available from your nearest repository :)


Cya!

Bjrnarlinux

  • Member
  • *
  • Posts: 38
Re: Post your favorite shell commands!
« Reply #24 on: September 09, 2009, 09:44:29 pm »

I've always liked to use cal on my netbook. Gives me a nice geeky feeling when there are people looking.

Lynx is always useful.
Logged
Life is Beautiful. Let the future generations cleanse it of all evil, oppression and violence, and enjoy it to the full.

Leon Trotskys last words
Pages: 1 [2]