![]() Man expand # (or "expand -help" if on Linux)ĭu -chs #show the disk usage of directory (or current folder if 'directory' is omitted) -c for grand totalĭf -h #shows disk space on each device, -h is to use kilo/mega/giga bytes.ĭf -h `pwd` #show disk space corresponding to mount point of the current folder.ĭu -h -max-depth=1 #show the disk usage of all subfolders (with max depth=1).ĭu -hd1 #show the disk usage of all subfolders (with max depth=1).ĭu -h -d0 #same as above (but with max depth=0). Unexpand filename.cpp > newfile.cpp #Unexpands spaces back to tabs cpp: ASCII English text, with very long linesĬat filename | more #Prints file, redirecting the output to "more "Ĭat filename | less #Prints file, redirecting the output to "less"Ĭat `which filename` #Prints file that's in the path but not the current folderĮxpand -t 4 filename.cpp > newfile.cpp #Expands tabs to 4 spaces cpp #check line terminators of Unix version.įilename. cpp.crlf #backup existing fileįile filename. Running a Command as a Background Process: "No Hangup"įor more info, a good introduction to shell scripting can be found here.Ī really good tutorial on the bash text-processing commands: awk, col, column, colrm, cut, expand, fmt, fold, grep/fgrep/egrep, head, join, look, nl, paste, sed, sort/tsort, tail, tr, uniq, wc can be found here.įile Line Terminators (CRLF in Windows / Dos, LF in Unix, etc.)įile #shows what kind of file this is, also reports whether line endings are terminated using CRLF.Ĭonverting from CRLF to Unix line terminators - exampleįilename.cpp: ASCII English text, with very long lines, with CRLF line terminators Man -k command #get man pages that match the keyword: commandĬommand > file#redirects stdout to be appended to fileĬommand 2>&1 #redirects stderr (2) to stdout (1)Ĭommand 1 >& 2 #redirects stdout (1) to stderr (2)Ĭommand 2>&1 | tee file#stderr (2) and stdout (1) combined and output to both file and stdout (display). Man 2 command #get help on section 2 of command (./folder gets created if it doesn't already exist) n = dry run, -r = recurse into directories, -d = transfer directories w/o recursing, -t = preserve timesĬopying within the same machine: (replace folder with your own folder name) u = skip files that are newer on the receiver, -delete = delete files which don't exist on sender. a = archive mode, -v = verbose, -z = compress, -b = backup (if the file already exists, it gets renamed). from current directory to remote folder #copy from remote folder to current directory Ĭp -v file1 file2 newpath/ #copies file1 & file2 to newpath verbosely (shows which files get copied) #same as above on Linux, but on Mac (& I think FreeBSD) this copies contents of ~/folder/ to. newfilenameĬp filename newpath/ #copies filename to newpath/ filenameĬp -Rp ~/ folder ./ #copies folder & its subtree to. options: -i = interactive, -f = force, -p = preserve, -R = recursive (note: not all flavors of unix allow -r to be an alias for -R), -P = follow symbolic linksĬp filename newfilename#copies filename to. Mv filename newfilename#rename filename as newfilenameĬopying Files using cp, scp, rsync, sftp. Mv -i filename folder/ #move file to folder/ (prompts if a file will be overwritten) ![]() Ln -s folder #create symbolic link to folder Mkdir -p folder#create folder (-p to create any intermediate directories required) */ #list directories in folder that begin with '.' Ls -trlph #list files w/reversed time, long format, with / in directory paths, using kilo/megabytes etc. Ls -Srl #list files in folder by size (largest file last) || įalse & echo "T" #does not echo anything $-Tab-Tab #show environment #show entries from /etc/hosts ![]() terminates currently executing command (after enter has been pressed)Ĭtrl-l #linefeed til current screen is cleared & put cursor at the top of the screen.Ĭtrl-w #delete from before the cursor to the start of the word before itĬtrl-u/k #delete from before/at the cursor to beginning/end of line History #get history of last-used commandsĬtrl-c #cancel current line (before enter has been pressed). ! command#repeat last command that starts with the characters following the exclamation mark dmesg #show bootup messages (sudo required for Mac OS X)Īlias 'lsd'='ls -d */' # alias 'lsd' to list the directories in folderĬommand1 #this is the first commandĬommand2 !$ #execute command2 using the previous command's arguments List of commands typically available in a bash shell environment, including various shell commands (such as those found in GNU coreutils) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |