简体   繁体   中英

Hidden (or not commonly known) windows and unix commands?

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.

linux: history (history of command line)

mogrify (for all image needs/operations)

screen (for running programs after logging off via ssh)

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

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 ;-)

我不确定这是否算作未知数,但是rsync是无价的。

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.

主机文件可用于过滤在线广告。

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 !$

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

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.

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

and regedit of course

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.

在PowerShell中,您可以:

cd \\server\c$\

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!)

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM