views:

490

answers:

15

What is that one not usually known command in unix and windows that you know?

It is heard that windows contains several hidden applications which sometimes may be very useful.

+3  A: 

linux: history (history of command line)

mogrify (for all image needs/operations)

screen (for running programs after logging off via ssh)

dusoft
screen can be very useful!
Thr4wn
+1 for screen, so useful!
Andrea Ambu
+2  A: 

I'm not sure if this counts as unknown, but rsync is invaluable.

Ben Alpert
+2  A: 

In older versions of Windows (XP, in particular), I found the shutdown command invaluable. For example:

shutdown /s /t 3600

will shut down the computer in an hour. Linux, of course, has a similar command (I'd say the majority of Linux users are intimately familiar with "shutdown -h now"), but the Windows equivalent is less well known.

The reason I mentioned older versions of Windows is that in newer ones (Vista I know for sure, don't know about Windows Server 200x) the functionality of shutdown has been hobbled a bit. For example, you can only set a maximum wait time of ten minutes, which makes it useless if you want your computer to shut down in an hour or two, when a download is done.

Domster
A: 

on windows i used to like gpedit.msc but i think its only on certain versions of xp

and regedit of course

iterationx
+3  A: 

In widows XP if you have ever tried to do somthing like this

cd \\pc\c$

You will have recieved the error

CMD does not support UNC paths as current directories.

Well you can use UNC paths as long as you map them to a temp drive letter like so.

pushd \\pc\c$

Then when you want to return simply...

popd
Fraser
pushd/popd are also available in bash (without the UNC support obviously), useful tools
Joachim Sauer
what do they precisely do?
Andrea Ambu
@Andrea: pushd pushes the current directory on a directory stack and moves to the directory specified by the argument. popd pops the top directory of that stack and changes to it. This way you can do "pushd /some/directory ; do-stuff ; popd" and are back to your original directory.
Joachim Sauer
+1  A: 

The hosts file can be used to filter online advertising.

Rob Kam
+1  A: 

In bash's ~/.bashrc file:

set -o vi

and in ~/.inputrc

set editing-mode vi
set keymap vi

Also, Using !$ to avoid retyping:

ls long/dir/name/i/dont/want/to/repeat/file.txt
rm !$
gpojd
I wish I could favourite answers in addition to questions. =]
strager
A: 

mmc.exe

you can do amazing things with the bare-bone version of the management console, given admin access to some machines in a network.

Andreas Petersson
+3  A: 

Windows:

fdisk /mbr

Saved my life (and system) after a Linux partition went berserk.

Linux:

strace

Came handy getting passwords with classmates running a telnet from a shell I was logged in ;-)

dirkgently
A: 

In PowerShell, you can:

cd \\server\c$\
tsilb
+1  A: 

In Unix: apropos (rough idea of what you want) | less

Andrew
man -k is identical to apropos (IIRC), and easier to remember IMO.
strager
A: 

In Windows, I use SET alot to get the basic information of the computer easily. There's also: IPCONFIG /FLUSHDNS, IPCONFIG /REGISTERDNS (to clear and reload dns entries), TRACERT (used to trace a path between your location and another on the network/internet), NETSTAT -s -p tcp (for network statistics), and PATHPING (like ping but better!)

JFV
A: 

I find that findstr is relatively unknown, at least I didn't know about it. It's a rough equivalent to grep, nice when you're not necessarily wanting or needing to install something like mingw or cygwin or even a natively built grep.

 c:\Users\logan>findstr /?
 Searches for strings in files.

 FINDSTR [/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/P] [/F:file]
         [/C:string] [/G:file] [/D:dir list] [/A:color attributes] [/OFF[LINE]]
         strings [[drive:][path]filename[ ...]]

   /B         Matches pattern if at the beginning of a line.
   /E         Matches pattern if at the end of a line.
   /L         Uses search strings literally.
   /R         Uses search strings as regular expressions.
   /S         Searches for matching files in the current directory and all
              subdirectories.
   /I         Specifies that the search is not to be case-sensitive.
   /X         Prints lines that match exactly.
   /V         Prints only lines that do not contain a match.
   /N         Prints the line number before each line that matches.
   /M         Prints only the filename if a file contains a match.
   /O         Prints character offset before each matching line.
   /P         Skip files with non-printable characters.
   /OFF[LINE] Do not skip files with offline attribute set.
   /A:attr    Specifies color attribute with two hex digits. See "color /?"
   /F:file    Reads file list from the specified file(/ stands for console).
   /C:string  Uses specified string as a literal search string.
   /G:file    Gets search strings from the specified file(/ stands for console).
   /D:dir     Search a semicolon delimited list of directories
   strings    Text to be searched for.
   [drive:][path]filename
              Specifies a file or files to search.

 Use spaces to separate multiple search strings unless the argument is prefixed
 with /C.  For example, 'FINDSTR "hello there" x.y' searches for "hello" or
 "there" in file x.y.  'FINDSTR /C:"hello there" x.y' searches for
 "hello there" in file x.y.

 Regular expression quick reference:
   .        Wildcard: any character
   *        Repeat: zero or more occurrences of previous character or class
   ^        Line position: beginning of line
   $        Line position: end of line
   [class]  Character class: any one character in set
   [^class] Inverse class: any one character not in set
   [x-y]    Range: any characters within the specified range
   \x       Escape: literal use of metacharacter x
   \<xyz    Word position: beginning of word
   xyz\>    Word position: end of word

 For full information on FINDSTR regular expressions refer to the online Command
 Reference.
Logan Capaldo
+1  A: 

On Windows XP+:

  • fsutil, the file system utility. I use this when I have to create test files of a specific size (fsutil file createnew <filename> <length>).
  • netstat, Displays protocol statistics and current TCP/IP network connections.
  • netsh, the network services shell; command line hook into all sorts of network info.
  • reg, the registry shell, for working with the registry from the command line.
Patrick Cuff
didn't know about netsh - look interesting
Preet Sangha
A: 

I just thought to put this in as I used it today about on 5 windows XP machines.

systeminfo

Gives you a list of your system details including os, hotfix/updates, hardware and network information. Sure you can get all this information in a lot of other places, either with commands or in the GUI but this is a great command to find out a lot about a machine very quickly.

Fraser