Revision [30104]

This is an old revision of DosCli made by darkcity on 2014-05-18 12:31:18.

 

The following is aimed at dos users that are not

already extremely comfortable with the linux command

line interface (cli) and also may be useful to linux

users that aren't already extremely comfortable with

the dos cli, and should be useful without or in xwin

attrib

examples:
attrib *.*
# shows attributes of all files a h r s (archive hidden readonly system)
attrib *.txt +a
# set all txt files to have archive attribute (*.* applies only to current folder)
attrib *.* -a -h -r -s
# remove all attributes from all files
# (if you cant change attributes in dos the file is locked, or, remove -a -h -r -s at once)

in linux:
chmod
(and/or)
chattr
(and/or)
chown
examples:
chmod 777 hello.sh
# makes it so everyone can read, write, or run a file (as an executable)
# for executable files (binary and scripts) chmod 755 hello.sh is better
# chattr changes some attributes of files (somehow...)
# chown changes the owner of the file

cls

examples:
cls
# clears the screen

in linux:
#where is it? cls? clear? clr? home? cl?
#here it is:
reset
# does the whole scrolly bit over, like closing rxvt and reopening it (that part applies more to xwin of course)

copy

examples:

copy hello.txt hello.bak
# makes a backup of hello.txt
copy a:\*.txt c:\hello
# copies all files ending in .txt in a:\ to a folder called hello on the c: drive, but does not work unless folder exists
# usually, and used from the console, copy will ask before overwriting an existing file. not usually from a script

in linux:
cp hello.txt hello.bak
# same as dos example
cp /mnt/floppy/*.txt /mnt/home/hello
# assumes floppy and c: drive are at the above mount points. will create folder called hello if it doesn't exist
# cp does not ask before overwriting. using cp -i instead of just cp will force interaction (not overwrite without asking)

cd (or) chdir

examples:
a:
cd \
# changes to a drive and folder \
cd ..
# changes to parent folder
cd \hello\there
# changes to hello\there folder from \
cd there
# changes to there from current folder
cd
# displays current folder

in linux:
# virtually the same. in dos, cd/ and cd.. are okay, in linux the space is required: cd / and cd ..
# you have to use cd (instead of chdir)
# cd (nothing else) does not show the current folder in linux. pwd (print working directory) is used instead.
# to change to the "a:" drive in linux (from the gui)
# run mut from xwin (or click the drives icon) and click [scan] on fd0
# click [mount]
# from the console:
cd /mnt/floppy
# when done: click [unmount]
# click [noscan]
# you could also learn how to use mount from the console (sorry, not included in this howto)
# mut is so great, someone should make a console version that uses keys like a b c d e f g h (buttons, not driveletters!)
# (maybe barry or mu or i will make a console version someday? don't know what it entails)

del (or) delete (or) erase

examples
del *.*
del .
# (either one) deletes all files in a folder
del *.txt
# deletes all files ending in .txt
del hello.txt
# deletes hello.txt

in linux:
# be careful with * wildcards!
# if you are going to use a wildcard, use "ls [wildcards]" instead of "rm [wildcards]" to see what may be deleted...
rm *
# deletes files; if someone randomly tells you to type rm -f * or something like that, kick him. hard...
rm *txt
# deletes files ending in txt
# -r is recursive (recursion in dos and linux are not exactly the same, that's why you don't see more notes on it here)

dir

dir *.txt
# list all txt files
dir *.txt /b /a > list.txt
# list all txt files even if they are hidden. /b says just show filenames... send output to list.txt
dir /w
# show files in a multicolumn layout
dir c:\*at* /a /s
# show all files in all folders in the c drive, if the filename contains "at"
dir /?
# show more info on dir. works on many dos commands

in linux:
ls *.txt
# same as in dos, but if there is a folder called something.txt it will show that folder too, etc.
ls *.txt -1 -a > list.txt
# include "hidden" files that start with . (yeah they are hidden) in one column... send output to list.txt
ls
# this is more like dir /w
ls -l
# that's an l like in "linux" not to be confused with -1 (one) from the other example. this outputs more like dir
ls /*at* -a
# show all files containing "at" in the name, but only in the / folder, and any folders recursed that also include "at"
ls --help
# show more info on ls. works on many linux commands
# here's a really good one, thanks to jcoder24 for it:
find / -depth -name *at*
# this is much closer to dir /s /b in dos, and in xwin try it with: | leafpad &

exit

examples:
exit
# closes the console in windows

in linux:
# it's the same, but will close the apps opened from the console too.
# the way around this is to append any command with & for instance:
leafpad hello.txt &
# now hit enter a couple times (or wait a minute)
exit
# right. also, if you click [X] on the window, the & is moot... it closes apps even if they were run with &

echo

examples:
echo
# display if "echo" is on or off
echo.
# echo a blank line (useful in scripts to look nice)
echo cd \ > hello.bat
echo dir *.txt
hello.bat
# this creates a script called hello.bat that changes to the \ folder and shows the .txt files there.
# > writes to a file (overwrite / create new)
#
apppends to a file (append / create if not existing)
# to run the script, enter:
hello
# you can type hello.bat but the suffix is required in the name

in linux:
echo
# blank line, same as echo. in dos
echo cd / > hello.sh
echo ls *.txt
hello.sh
chmod 755 hello.sh
# creates the same script as above and makes the script executable
# to run the script, enter:
./hello.sh
# you must type .sh at the end if it's part if the name, but you don't have to name it that way

fc

examples:
fc hello.txt hello.bak
# show the differences between the two files, if any
fc /b hello.exe hello2.exe
# do a binary comparison of files (shows differences in hex, if any)

in linux:
diff hello.txt hello.bak
# basically the same idea. for binary files, you can try just using diff
# also, you can try this:
md5sum hello
md5sum hello2

usually when two files are different, the single-line md5sum is different. file integrity checking is often done this way

move

examples:
move *.txt a:\hey
# move all .txt files to a:\hey
move hellofolder hello2folder
# rename a folder

in linux:
mv *.txt /mnt/floppy/hey
# same as above, assumes mountpoint at /mnt/floppy
mv hellofolder hello2folder
# rename a folder

md (or) mkdir

examples:
md hello
# create folder named "hello"
mkdir hello
# same thing
md /mnt/home/hello
# create "hello" folder in /mnt/home
mkdir /mnt/home/hello
# same thing

in linux:
# you have to use mkdir (instead of md)

ren (or) rename

examples:
ren hello.txt hello.bak
#rename the file to...

in linux:
mv hello.txt hello.bak

rd (or) rmdir

examples:
rd thisisafolder

in linux:
rm -r thisisafolder
# dos won't usually let you remove a folder that has files in it
# linux usually will

rem

examples:
rem hey look, this does nothing!

in linux:
# this usually does nothing!
# however, the following is used to identify a bash script:
#!/bin/sh
# the following is used to identify a puppybasic script:
#!/usr/bin/wxbasicscript
# you get the idea. technically, it STILL does nothing... but it does, however, change how a script is interpreted
# (or how a file is identified)
# all bash scripts should really start that way you know:
#!/bin/sh
# but my creation of a script using echo without that header still worked

start

examples:
start notepad
start http://pupweb.org
#this is really a windows thing... but a command preceded by "start" sometimes works when it ohterwise would not
start cmd /c dir | more
# opens a new console, runs dir and pipes to more

in linux:
# exec is somewhat, but not exactly, like start. xwin does not need to be running to use it.
# sometimes preceding a command with exec helps in .rc files when you want to run a command
# to open a website, use defaultbrowser:
defaultbrowser http://pupweb.org
# to open a new console:
rxvt &
# to run a command in a new console:
rxvt -e ls | more
# opens a new console, runs dir and pipes to more

time

examples:
time
# shows/sets current time
time 00:00:00
# sets time to midnight
# to do the same with the date:
date

in linux:
date
# shows the time (it also shows the date)

type

examples:
type hello.txt
# displays a text file
type hello.txt | more
# displays a text file with more
more hello.txt
# same as the previous example

in linux:
more hello.txt
# same as dos
less hello.txt
# "less is more" Razz less lets you scroll... (caveat, i forget how to make it stop)
more hello.txt | leafpad
# that one is fun, try with ls or find (does not work with mp)
# this seems to work:
more hello.txt | less
# the idea being more useful with things like ls and find since leafpad isnt available when xwin isn't
# if you don't love any of those, try using cat for type:
cat hello.txt
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki