Unix Commands Quick ReferenceUseful commands and flags that we get tired of looking up...Disk SpaceThedu command is verbose and confusing if you run it without options. Here is how to get a human-readable output and a grand total for the path argument (omit for current directory).
du -hc
Fixing Line EndingsIf you get odd errors after transferring a text file from a PC or Mac to a Unix machine, it's likely that you have a problem with newline characters![]() tr "\r" "\n" < input.tab >.converted.tab
Merging commands to be serial on TACCSometimes you have 96 short jobs that you want to run serially 8 at a time on 12 cores rather than requesting 96 cores. This command will combine every 8 lines in a file into one line separated by && so that these commands are now run on one core.paste -s -d'#######\n' commands | sed "s/#/ \&\& /g" > commands8
Adding your path to the command promptAdd to your.bashrc or similar bash startup script:
export PS1='\w\$ ' | ||||||||
Added: | ||||||||
> > |
Useful Bash CommandsThese commands are also compatible with the Terminal (Mac OS X) as well as the Windows Bash emulator called Cmder![]()
cat yourfile.txt Prints the contents of the given file to the console.
Adding Directories to the PATH VariableWhen you invoke commands such aspython3 via Bash, it searches all file directories listed in your PATH in order to execute that command. Errors such as "command not found" (Linux) or "not recognized as an internal or external command, operable program or batch file" (Windows) when you try to invoke something mean you need to add the directory containing that program to your PATH.
The Windows equivalent on Cmder is ContributorsDr. Jeffrey Barrick, Lucy LeBlanc |