UGN Security Forums
My ProfileMember DirectoryLogin
Search our ForumsView our FAQView our Site Rules
View our CalendarView our Active TopicsGo to our Main Page

UGN Security Store
 

Network Sites UGN Security, The GoNix Initiative, Elite Web Gamers, Back of the Web, EveryDay Helper, VNC Web Design & Development
Sponsored Links
Latest Postings
Latest Reviews
Page 1 of 2 1 2 >
Topic Options
Rate This Topic
#16478 - 02/19/04 11:00 AM Bash Tips and Tricks
sinetific Offline
nobody

Registered: 03/02/02
Posts: 815
Loc: Ann Arbor
Post your favorite tips and tricks that help make your life in the shell easier.

for i in ls *gz ; do tar -zxvf $i ; done

decompresses all the archives in a directory.

Top
Sponsored Links
      
#16479 - 02/19/04 06:59 PM Re: Bash Tips and Tricks
Gremelin Offline

Community Owner
*****

Registered: 02/28/02
Posts: 7193
Loc: Portland, OR; USA
ls = list files
ls -a = list all files, including hidden
ls -hal = list all files, including hidden, with details in a human readable format

rm = remove, for removing a file
rmdir = remove, for removing a directory
rm -rf [directory]/ = remove and format, for removing a directory with data.
_________________________
Donate to UGN Security here.
UGN Security, Back of the Web, Elite Web Gamers & VNC Web Design Owner

Top
#16480 - 02/19/04 07:18 PM Re: Bash Tips and Tricks
Gremelin Offline

Community Owner
*****

Registered: 02/28/02
Posts: 7193
Loc: Portland, OR; USA
-Ar -u[user] -p --auto-repair = have MySQL repair all databases.

service [service] restart = Restart specifide sevice
service [service] stop = Stop specifide service
service [service] start = Start specifide service

du -h --max-depth=1 = Check (by directory) where all your space is at.

su = change user
make && make install = install script

cd /home/virtual;for c in site*;do cat $c/info/current/ipinfo|grep ipaddrs;done = Check what IP's are linked to what user accounts (I work for a webhost, I have to know it)

EditVirtDomain -c ipinfo,namebased=0,ipaddrs=[1.2.3.4] -D domain.com = Change name based domain to IP based.

EditVirtDomain -c ipinfo,namebased=1,ipaddrs=[] -D domain.com = Change IP based site to Name Based.

ntpdate time.windows.com = Sync time with Microsoft

If you have subdomain issues or need to add one their located in /etc/httpd/conf/subdomains.conf
_________________________
Donate to UGN Security here.
UGN Security, Back of the Web, Elite Web Gamers & VNC Web Design Owner

Top
#16481 - 02/19/04 07:24 PM Re: Bash Tips and Tricks
Gremelin Offline

Community Owner
*****

Registered: 02/28/02
Posts: 7193
Loc: Portland, OR; USA
If user is having an issue with Perl or PHP interpreters within the ensim service do the following:

sitelookup -s [username]
sitelookup -d [domainname]

(be sure they match up, we're compairing the server validations of where the username belongs and where the domain name belongs to be sure we aren't working with the wrong account)

cd /home/virtual/[username]/fst/var/www
ls

(we're trying to see if the interpreters directory exists, which it should, otherwise skip this step and the next step's RM)

ls interpreters

(If interpreters show up then there isn't a problem, if not, continue)

rmdir interpreters
DisableVirtDomain [domain]
EnableVirtDomain [domain]

(Here you tell the system to remove the interpreters directory, disable the account on the system, enable the account on the system. Re-enabling causes the Ensim service to rebuild all data).

ls interpreters

(interpreters should now exist, user account should now be able to use their account once again)
_________________________
Donate to UGN Security here.
UGN Security, Back of the Web, Elite Web Gamers & VNC Web Design Owner

Top
#16482 - 02/19/04 07:25 PM Re: Bash Tips and Tricks
Gremelin Offline

Community Owner
*****

Registered: 02/28/02
Posts: 7193
Loc: Portland, OR; USA
tar -cvzf [archivename].tgz /path/to/archive/ = Archive path to a .tgz file.

tar -cvzf [archivename].tgz /path/to/archive/ --exclude=/path/to/archive/yet/leave/out/ = Archive path to a .tgz file BUT leave out second path of files.
_________________________
Donate to UGN Security here.
UGN Security, Back of the Web, Elite Web Gamers & VNC Web Design Owner

Top
#16483 - 02/19/04 08:53 PM Re: Bash Tips and Tricks
Gremelin Offline

Community Owner
*****

Registered: 02/28/02
Posts: 7193
Loc: Portland, OR; USA
./end sysadmin guide

lol, I have to memorise pretty much all of that for work ;-x...
_________________________
Donate to UGN Security here.
UGN Security, Back of the Web, Elite Web Gamers & VNC Web Design Owner

Top
#16484 - 02/19/04 09:53 PM Re: Bash Tips and Tricks
Shinobi Offline
UGN Member

Registered: 09/25/02
Posts: 390
Loc: Asheville, NC
su and sudo ....they are the biggest time savers in the universe
_________________________
"The secret to creativity is knowing how to hide your sources."
-Albert Einstein

Tech Ninja Security

Top
#16485 - 02/19/04 10:04 PM Re: Bash Tips and Tricks
Gremelin Offline

Community Owner
*****

Registered: 02/28/02
Posts: 7193
Loc: Portland, OR; USA
su [username] = change usernames. Some systems don't allow direct login to the root user so you need to su to the username.

sudo = used for giving users access to commands without actually giving them access to commands... Example: "sudo su -" can be set to log the user as root without needing password :glares at drak:
_________________________
Donate to UGN Security here.
UGN Security, Back of the Web, Elite Web Gamers & VNC Web Design Owner

Top
#16486 - 02/19/04 10:25 PM Re: Bash Tips and Tricks
sinetific Offline
nobody

Registered: 03/02/02
Posts: 815
Loc: Ann Arbor
ok I wasnt really looking for a description of bash commands... more like combinations of them.
I think there is already a post here containing basic bash commands.
*rm -rf = remove recurisive and force

dmesg | grep [device name]

outputs boot hardware information about a specific device useful for troubleshooting kernel problems. If the device is CD it will spit out info about your CD roms if you use hd as the device it will tell you about your harddrives

cat /var/log/XFree86.0.log | grep EE

outputs any errors from your xconfig log. makes troubleshooting X hella easier or switch EE with WW to view warnings.

Top
#16487 - 03/01/04 09:02 PM Re: Bash Tips and Tricks
Gollum Offline
Member

Registered: 06/05/02
Posts: 207
Loc: US
i always find myself using "locate [file] | grep [bin|png]" or whatever file i'm looking for
usually either when i'm looking for icons to use i'll do like "locate ethereal | grep png" or when trying to find where a program runs from, "locate mysql | grep bin"
enormous timesavers just b/c i don't pay as much attention as i should when i install stuff. well, i make sure i install it right, but about 4 hours later i forget where that was, lol
and of course, ps -aux | grep [program name]
speaking of which, i'm trying to find a way to pipe a process id into kill....but i can't figure it out. kill always comes back with an error everytime i try. i figure it'd be a huge timesaver if i can just write up a shell script where i just type in like "slackill [program]" and by going through ps and grep and cut and kill....it'll kill the process for me//
_________________________
Unbodied unsouled unheard unseen
Let the gift be grown in the time to call our own
Truth is natural like a wind that blows
Follow the direction no matter where it goes
Let the truth blow like a hurricane through me

Top
#16488 - 03/02/04 04:23 AM Re: Bash Tips and Tricks
§intå× Offline


*****

Registered: 12/03/02
Posts: 3255
Loc: Maryland
Okay this may soud ignorant, How do I restart my system from the commandline. I got rid of my GUI on my webserver and I just use bash now.
_________________________
My New site OpenEyes

Top
#16489 - 03/02/04 04:58 AM Re: Bash Tips and Tricks
Gremelin Offline

Community Owner
*****

Registered: 02/28/02
Posts: 7193
Loc: Portland, OR; USA
restart :x
_________________________
Donate to UGN Security here.
UGN Security, Back of the Web, Elite Web Gamers & VNC Web Design Owner

Top
#16490 - 03/02/04 10:33 AM Re: Bash Tips and Tricks
Infinite Offline



Registered: 03/09/02
Posts: 1041
Loc: Canada eh
or

# reboot

or

# shutdown -r now

Top
#16491 - 03/02/04 12:18 PM Re: Bash Tips and Tricks
§intå× Offline


*****

Registered: 12/03/02
Posts: 3255
Loc: Maryland
shutdown -r now


that is the one I was thinking of. Thanx
_________________________
My New site OpenEyes

Top
#16492 - 03/02/04 01:57 PM Re: Bash Tips and Tricks
pergesu Offline
UGN Elite Poster

Registered: 03/14/02
Posts: 1136
Loc: Pimpin the Colorizzle
just be careful...I did

shutdown now -r

once, and it shut down the server in Denver. My boss wasn't happy

Top
Page 1 of 2 1 2 >

Moderator:  Infinite 
Featured Member
Registered: 02/28/02
Posts: 7193
Forum Stats
2149 Members
46 Forums
35362 Topics
70532 Posts

Max Online: 1567 @ 04/25/10 05:20 AM
Top Posters
UGN Security 28523
Gremelin 7193
§intå× 3255
SilentRage 1273
Ice 1146
pergesu 1136
Infinite 1041
jonconley 955
Girlie 908
unreal 860
Newest Members
Tim050, Gecko666, defghi795767, Devo60, ali
2148 Registered Users
Who's Online
0 registered (), 411 Guests and 320 Spiders online.
Key: Admin, Global Mod, Mod
Latest News
luxury goods sales at $405B by 2019
by golqm
10/28/14 05:19 AM


Donate
  Get Firefox!
Get FireFox!