Useful Linux Commands Example: Qsub Submission-Script File/Directory Basics Bluecrystal 3 Reference Card Ls List Directory Contents

Useful Linux Commands Example: Qsub Submission-Script File/Directory Basics Bluecrystal 3 Reference Card Ls List Directory Contents

module add openmpi/gcc/64/1.6.5 qdel Delete batch job with given job ID. Using the Queuing System example: qdel 673615 qsub Submit job to queuing system. Useful Linux Commands example: qsub submission-script File/Directory Basics BlueCrystal 3 Reference Card ls List directory contents. Advanced Computer Research Centre where the following submission script contains the examples: https://www.bris.ac.uk/acrc minimal information required to submit ls -ltr Long listing, most recently modified last. [email protected] ls -h File sizes in readable format e.g. 1K, 234M. a serial program to the veryshort queue Logging In (wallclock limit 2hrs): pwd Print working directory. ssh Secure shell. #!/bin/bash cd Change current directory. options include: a #PBS -l nodes=1:ppn=1,walltime=02:00:00 examples: -X Enables X11 forwarding. cd .. Change to directory above. example: cd $PBS_O_WORKDIR cd /path/to/dir Change to directory given in path. ssh user@bluecrystalp3 ./my-serial-program multi-threaded program: cp Copy files and directories. Transferring Files examples: or an cp file1 file2 create a copy of file1 called file2. #!/bin/bash scp Secure copy. MPI cp -r dir1 dir2 recursively copy dir1. options include: #PBS -l nodes=1:ppn=4,walltime=02:00:00 -r Recursively copy entire directories. cd $PBS_O_WORKDIR mv Move (rename) files and directories. examples: ./my-multi-threaded-program examples: scp local.tar.gz user @bluecrystalp3:~ (distributed memory parallel) program: mv file1 file2 Rename file1 as file2. scp -r user @bluecrystalp3:/remote/path . mv dir1 /new/path Move dir1 to a new location. winscp scp/sftp GUI for windows. #!/bin/bash rm Remove files or directories. #PBS -l nodes=2:ppn=4,walltime=02:00:00 examples: cd $PBS_O_WORKDIR Checking Your Quota rm -i file1 Prompt before deleting file1. cat $PBS_NODEFILE > machine.file.$PBS_JOBID rm -rf dir1 Recursively & forcefully remove dir1. BCp3: pan_quota numnodes=`wc $PBS_NODEFILE | awk '{print $1}'` mpirun -np $numnodes -machinefile \ mkdir Make directories. Configuring Your Environment machine.file.$PBS_JOBID./my-mpi-program rmdir Remove empty directories. Ensure that you have the appropriate module add module Interface to modules package. commands in your shell start-up file (e.g. ~/.bashrc). ln Make links between files and directories. options include: examples: avail List all available modulefiles. qstat Show status of batch jobs. ln -s /path/to/dir1 ./dir1 Symbolically link to dir1. add Load modulefile into shell environment. options include: del Remove modulefile from shell environment. -u user Show only user's jobs. list List loaded modulefiles. -n List nodes allocated to a job. whatis Display the modulefile information. showq Show status of batch jobs—alternative format. example: Viewing & Manipulating Text Files gedit Text editor. example: head Output the first part of files. emacs Text editor. du -sh . Summarize (in readable format) total example: usage of file-tree rooted in current dir. head -7 file.txt View first 7 lines of file.txt. Redirection and Pipelines > Redirect stdout. df Report file system disk space usage. tail Output the last part of files. example: example: example: cat file1 file2 > file1-and-2 df -h . Report usage (including available space) for tail -7 file.txt View last 7 lines of file.txt. file system holding current dir. < Redirect stdin. cat Concatenate files and print to stdout. Searching For Things example: >> Redirect stdout and append. grep Print lines matching a pattern. cat file1.txt file2.txt Append file2.txt to file1.txt. example examples: cat file1-and-2 file3 >> file-1-and-2-and-3 grep -n 'foo' file.txt Print all lines (prefixing the wc file.txt Print line, word and byte counts. line number) containing 'foo' in file.txt. diff file1.txt file2.txt Compare files, line by line. | Pipe stdout from one cmd to stdin of another. grep -i 'foo' * Print all lines containing 'foo' (case example: insensitive) from all files in current dir. cut Print selected parts from each line of files. head -7 file1 | tail -1 view 7th line of file1 example: find Search for files in a directory hierarchy. cut -d',' -f1,2 file.csv Print first two columns of file.csv. Viewing Other Files od Dump files in octal and other (e.g. binary) which Locate a command. paste Merge lines of files. formats. example: example: nm List symbols from object (& library) files. which gcc Report location of gcc compiler. paste file1.txt file2.txt Concatenate each line of file1.txt example: and file2.txt, in turn, and print. nm mylib.a | less view symbols in mylib.a, one whoami Print effective userid. page at a time. man An interface on on-line reference manuals. sort Sort lines of files. info Read Info documents. examples: ldd Report shared library dependencies. ? Wildcard: matches a single character. sort -d file1.txt Print contents of file1.txt in dictionary example: * Wildcard: matches any sequence of characters. order. ldd myprog.exe View myprog.exe's dependencies. sort -nr file1.txt Print contents in reversed (descending) numerical order. Compressing and Combining File Properties tar Archiving utility. file Determine file type. uniq Report or omit repeated lines. example: example: tar -xzf archive.tar.gz Unpack compressed archive. touch Change file timestamps. uniq file1.txt Print only unique lines of file1.txt. example: gzip Compress files. touch file1 Updates access and modification times sed Stream editor for filtering and transforming. example: of file1 to the present time. examples: gzip file.txt Compress file.txt. sed 's/cat/bat/g' file1.txt replace all instances of 'cat' in gunzip Expand files. file1.txt with 'bat'. chmod Change file mode bits (change permissions) sed 's/*ed//g' file1.txt replace all words in file1.txt ending example: Process Management with 'ed' with the empty string. chmod a+r file.txt Allow all to read file.txt. top Display Linux tasks. kill Send a signal to a process. awk Pattern scanning and processing language. chown Change file owner and group. fg Place a job in the foreground. example: md5sum Compute/check MD5 message digest. bg Place a job in the background. awk '{print $2}' file1.txt Print second column of file1.txt. du Estimate file space usage..

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    2 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us