Search:  

 
 
   All ForumsHot TopicsGallery






how-to block ads


 
Forums » Tech and Talk » OS and Software » All Things Unix » Little Known Tips and Tricks...
Search Topic:
Uniqs:
25513
Share Topic:
RSS topic:
toggle:
flat / full
normal / watch
Posting:
Post a:
Post a:
Gaim alternatives? »
« Need Light Network Enabled Distro..  
page: 1 · 2 · 3 · 4 · 5 · 6 ...12 · 13 · 14
AuthorAll Replies


TivoNut
Premium
join:2002-04-18
Yorba Linda, CA

reply to dom6791
Re: Little Known Tips and Tricks...

Using command-line ftp in *nix or DOS/Windows, you can use "lcd" to change your local working directory. But what if you want to know what your local directory is to begin with? (Say you lost track of where you're at.) You can always shell out and do pwd in *nix. My trick is to just type "lcd ." at the ftp command prompt. This effectively does nothing, but does report your current *local* working directory, and works on all OSes that I've tried.
--
"I see a world market for about five computers." -Thomas J. Watson, IBM 1947


Drunkula
Premium
join:2000-06-12
Denton, TX

reply to dom6791
Okay it got quiet in here so here's another...

If the info on your terminal is scrolling by too quickly (like during a compile) Cntl-S will pause the output. Cntl-Q will resume.

[text was edited by author 2003-03-09 11:26:52]


Daniel
Premium,MVM
join:2000-06-26
Pleasanton, CA
clubs:

reply to dom6791
A vim tutorial...

Here's my attempt to get together all the commands necessary to teach myself (and others) vi/vim.

I hope it can help someone lose their disdain for vim; it's really a very powerful editor, and there are tons of commands that make it unlike any other in terms of efficiency and ease of use (once you get the hang of it).

»www.dmiessler.com/study/vim
--
"Opportunities multiply as they are seized." - Sun Tzu


FiberOpPraise
Premium
join:2000-10-29
Jamaica, NY
clubs:
reply to Steve
Re: Little Known Tips and Tricks...

If someone happens to create a filename named '*' do NOT do the following:

rm *
rm ./*

Instead, Do:

rm "*"

That works for me


sfromsf

join:2001-03-03
Sacramento, CA
clubs:
·SureWest Internet

why oh why would someone create a file named "*"?

Great tips thus far. Thanks for the vi commands. vi is wonderful when you know the darn commands.

Keep em coming for noobs like me.
--
Tough times do not last, tough people do |

MrH

join:2001-07-18
Lynnwood, WA
reply to dom6791
i would recommend pico or joe over vi


fritzmp
Biker Tux
Premium
join:2001-08-29
Warrenton, VA
clubs:

said by MrH See Profile:
i would recommend pico or joe over vi
That's all good and well, but that preference mite not be available on a job site as well as vim.


morph3ous
Premium
join:2002-05-16
Miami, FL
reply to dom6791
I heard that due to licensng issues with pico, it is better to use nano. They both look the same to me.


swcox
Adelphia High Speed Internet
Premium
join:2001-11-21
Greeneville, TN

reply to MrH
said by MrH See Profile:
i would recommend pico or joe over vi
I used to think that way too, until I found myself in several situations where vi was the only text editor available on the system!

It was use vi or not get anything done.

I would urge anyone that uses Linux to at least learn how to edit and save a file in vi.
--
Policy is often cited to avoid responsibility and decision-making.


fritzmp
Biker Tux
Premium
join:2001-08-29
Warrenton, VA
clubs:

We should Keep it to tips and tricks and not what editor is preferred over another.

So back on Topic.

File Permissions: Some no0bs don't understand the number system that is associated with files and directories.

Read is worth a 4, Write is a 2, and execute is 1. Add them up for 7. chmod 700 file_or_directory is a owner rwx/7 group 0 and others/world 0

grid

******owner group world

read=4--X-----X-----X

write=2-X-------------

exec=1-X-----X-----X

Thus the above=755
--
Free The Code, but remember there is a world outside. Stepping away from the box will help you solve the answers you seek. Anger blocks thought.


iMeowbot
Let's All Have Can
Premium
join:2001-11-20
Pembroke, MA

reply to morph3ous
The Pine/Pico license isn't really all that bad, it boils down to "you can use and redistribute all you like, but if you want to distribute modified versions, get the university's permission first." This isn't a problem for most people, but it gets under the skin of projects like Debian that operate under self-inflicted restrictions regarding licenses.


freerock
Premium
join:2001-05-04
New York, NY

reply to severely depressed
edit: man I need some sleep
[text was edited by author 2003-03-10 22:55:14]

paul1238

join:2000-11-03
Brookline, MA

reply to fritzmp
said by fritzmp See Profile:
File Permissions: Some no0bs don't understand the number system that is associated with files and directories.
Good idea for a tip. I hope you don't mind if I elaborate a bit.

In order to understand the filesystem's concept of permissions and file mode, it's important to remember that the file information are stored as bits. When using chmod or displaying file permissions and modes with ls -l, those applications are actually using a short-form notation.

The symbolic representation for a file permission can be:

rwx------ which represents three sets of bits where each group is made up of three bits. So the groups of bits from right to left describe the: OWNER, GROUP, and WORLD access permissions. Each of the three bits in a group represent READ, WRITE, EXECUTE from right to left.

The numbers that are used are base-8 or octal numbers not decimal numbers. An octal number is a convienient method of representing groups of three bits.

So when you do chmod 755 somefile, you are actually using octal numbers to represent the bit stream
111 101 101.

Note, that there are actually more bits available that describe a file. Two commonly used bits in the fourth group of bits are the the setuid bit which is 100 000 000 000 (4000 in octal) and the sticky bit which is 100 000 000 000 (1000 in octal).

So for example, if you want to create a file with setuid access, you might do chmod 4755 somefile. This would represent the bit stream 100 111 101 101.

The file mode bits actually contain several other bits which are not normally accessible to chmod but are available elsewhere. For example, symbolic links, directories, sockets, char devices, block devices, etc. Each of these types of files use the same group of bits to describe their permissions and modes.


Steve
I'm a PC, so shut up
Consultant
join:2001-03-10
Yorba Linda, CA

said by somebody quoted by paul1238 See Profile:
Some no0bs don't understand the number system that is associated with files and directories.
Neither the n00bs nor anybody else should fool with the numbers: it's difficult and often dangerous. Much better is to use the symbolic permissions, which are much less subject to surprises.

Symbolic permissions with chmod are a list of "sets", each of which is

scope
operation
permissions

"scope" is one or more of:
    u = user (the owner of the file)•g = group•o = other•a = same as ugo


"operation" is one of
    + add the permissions to existing ones•- subtract the permissions to existing ones•= set the permissions absolutely


"permissions" is one or more or
    r read permissions•w write permissions•x execute permissions
(yes, there are other permissions, such as sticky bit and setuid, but that's all in the man pages).

By stringing these together you can do what you want:

chmod a+r * - make all files readable

Because these permissions are relative, they don't destroy existing permission bits that you don't care about. There is no single numeric mode that would do this because no matter what you pick, it's going to muck with the (for instance) execute bits that you don't really want to. This means that you'll end up with directories that you can't get to any more.

Even when you do want to set hardcode permissions, do it with the symbolic mods:

chmod a=rwx * - same as chmod 777
chmod og= * - take away *everything* from others and group, but not touching "user" permissions

I cannot think of a downsize of the symbolic permissions, but I sure as hell can with the numbers.

Steve
--
Stephen J. Friedl • Security Consultant • Tustin, California USA • my web site


Eatmeingreek
Gentard

join:2001-06-29
San Francisco, CA

reply to dom6791
I dunno, Steve. I find the numbers much easier to remember than the alphabet soup. At this point I just know 0600 means read and write by owner without doing the math. There really are only a few combinations that are really useful.
--
We must destroy liberty to make the homeland safe for democracy


fritzmp
Biker Tux
Premium
join:2001-08-29
Warrenton, VA
clubs:
reply to dom6791
That proves to me Steve does lots of technical writing, which I hate. Bless those who that have the gift.


Schmackdown
Midwesterner
Premium
join:2002-08-26
Chicago, IL
clubs:
·CYBERONIC INTERNET..

reply to dom6791
Here's two I use on a regular basis. First, puTTY keys. I log in to about 5 RH 7.3/8.0 machines on a regular basis from a win2k box, and using Pageant and openSSH makes things a lot easier. You need puTTY, Puttygen and Pageant, all available from the puTTY website. Crank up Puttygen and kick out an SSH2 RSA key. Name it something(I usually name my keys after the workstation I'm logging in from), and give it a passphrase. Copy the text in the field at the top of the window, then save the private key on your hard drive. Open up puTTY, configure it to connect to your linux box using SSH2 and your username, then create a .ssh folder in your home directory if it's not there already. Set permissions on that to 755, cd to it and create a file called .authorized_keys. Edit it and paste in the key you copied from puttygen(vi .authorized_keys, hit i, right-click the mouse button for that sweet puTTY paste action, esc, :wq! and you're done), change the permissions on that file to 644, exit the session, open Pageant and load in your private key via the passphrase, open the connection from puTTY again and BAM it should authenticate with the key from Pageant. As a bonus, you get a computer with a fedora hanging out in your system tray.

Note that if you have ssh.org's SSH2 suite rather than openSSH, you'll have to do things a little differently, but the principle is the same. ssh.com should have documentation for it.

Second tip: use date's many flags to label files. I have a number of cron jobs that archive database dumps, transaction logs, access logs, etc. into tarballs that are labeled by date. Here's an example line from a cron job that uses date:

tar -zcf /scratch/dumps/MS-SQL/`date +%b%d%Y`MS-SQL.tar.gz /scratch/DMT*.dmp

That gives an output similar to Feb182003MS-SQL.tar.gz- it means I can stack up job output in a central directory until they get to be the perfect size for a CD, which gets monitored by another cron job. 'man date' for a slew of other options.


SegFault
Live From Wally World
Premium
join:2001-05-29
Wallingford, CT
clubs:

reply to dom6791
Here's one I recently picked up (at least on Linux)...I've been using different unix for about 15 years and have always been annoyed that when I setup a crontab job to run every 5 minutes, I had to enter 0,5,10,15,20,25,etc into the crontab file. Instead I found out that you can use "/" to divide up the settings so the following runs every 5 minutes:

*/5 * * * * /bin/some/command

The following runs every 4 hours:

* */4 * * * /bin/some/command

You get the picture...check out man 5 crontab
--
With sufficient thrust, pigs fly just fine.


Steve
I'm a PC, so shut up
Consultant
join:2001-03-10
Yorba Linda, CA

reply to Eatmeingreek
said by Eatmeingreek See Profile:
I dunno, Steve. I find the numbers much easier to remember than the alphabet soup. At this point I just know 0600 means read and write by owner without doing the math. There really are only a few combinations that are really useful.
Yes, the numbers aren't hard to learn, but they are not relative. If you want to make your files unreadable by anybody else:
code:
# ls -l
-r--r--r-- 1 root 9825 Jan 11 2000 License.txt
-r--r--r-- 1 root 7060 Jan 11 2000 README
-r--r--r-- 1 root 23065 Jan 11 2000 Release_Notes
-r--r--r-- 1 root 3301 Feb 15 2000 install.cfg
-r-xr-xr-x 1 root 31919 Jan 11 2000 install.sh*
dr-xr-xr-x 2 root 1024 Jan 11 2000 pkg/

# chmod 600 *

# ls -l
-rw------- 1 root 9825 Jan 11 2000 License.txt
-rw------- 1 root 7060 Jan 11 2000 README
-rw------- 1 root 23065 Jan 11 2000 Release_Notes
-rw------- 1 root 3301 Feb 15 2000 install.cfg
-rw------- 1 root 31919 Jan 11 2000 install.sh
drw------- 2 root 1024 Jan 11 2000 pkg/

Oops! You just made install.sh un-executable, and now you can't visit the pkg subdirectory anymore - your numeric modes acted on bits you didn't care about.

But chmod og= * would have done exactly what you wanted in one step.

Steve
--
Stephen J. Friedl • Security Consultant • Tustin, California USA • my web site


bbrkdub

join:2001-10-03
Houston, TX
·Comcast

reply to dom6791
Ok, I'll add another one. If you like cat(1) and less(1), then combine them to 'scroll' through your files. I use this little script for viewing a lot of my documentation without risking an accidental write from vi(1) (NOTE: I know about vi -R, but I like the way this script works).

# cat ~/bin/scroll
#!/bin/sh
cat $@ | less


Then, I just add an alias to my ~/.bashrc file:

alias s='scroll'
--
Hope this helps...
Forums » Tech and Talk » OS and Software » All Things UnixGaim alternatives? »
« Need Light Network Enabled Distro..  
page: 1 · 2 · 3 · 4 · 5 · 6 ...12 · 13 · 14


Saturday, 28-Nov 19:40:35 Terms of Use | Privacy Policy | Hosting by www.nac.net - DSL,Hosting & Co-lo | feedback | contact
over 10 years online! © 1999-2009 dslreports.com.
page compression OFF
Most commented news this week
· [122] Time Warner Cable Fires Broadside At Broadcasters
· [112] New AT&T Ad Campaign Hits Back At Verizon
· [96] Apple Joins AT&T Verizon Snark Fest
· [87] New Bill Takes Aim At Higher Verizon ETFs
· [80] TiVo Sees Record Customer Losses
· [70] Verizon CEO: Hulu Will Be Dead Soon
· [69] In-Flight Internet Headed For Bumpy Landing?
· [66] Weekend Open Thread
· [62] Thanksgiving Open Thread
· [40] EFF Wages War On Fine Print
Most people now reading
· Windows 7 boot manager editing questions [Microsoft Help]
· 3.x Feral Druid - Bear Tanking Guide [World of Warcraft]
· [Newsgroups] Newzleech down? [Filesharing Software]
· how to use the 2nd line with phone hooked to the 1st line? [VOIP Tech Chat]
· Digital Transport Adapter Unboxing Photos [Comcast Cable TV]
· Gizmo5 has added a Google Voice section in its members area. [VOIP Tech Chat]
· [ PVP] 3.2 DK PvP D/W Spec... [World of Warcraft]
· Why would I want an e reader? [General Questions]
· [How to] Install Asterisk on an Asus WL-520GU router [VOIP Tech Chat]
· Why not just turn off the ignition? [Automotive]