FAQ  •  Login

Euler Tips & Tricks

Moderators: Dan Negrut, ME964 Spring 2012

<<

Andrew Seidl

Administrator
Administrator

Posts: 193

Joined: Thu Oct 28, 2010 11:54 am

Unread post Thu Feb 09, 2012 1:54 pm

Euler Tips & Tricks

Post your own tips & tricks for using Euler (or Linux in general) and I'll eventually add them up here.

  • Text too small inside NX?
    - Change your DPI under System > Preferences > Appearance, Fonts > Details > Resolution. 96 or 100 would be a good starting point
  • Want folders to open in the same window instead of a new one?
    - In a folder window, Edit > Preferences, Behavior > Always open in browser windows
  • Want to change the default editor for your account? (replace nano with your favorite editor)
      Code:
    $ echo 'export EDITOR=nano' >> ~/.bashrc
    $ source /etc/profile

From S12nvandam:
  • Manpages will explain the basics of what a command does and what all it's flags are. to read the man page for, e.g., ls
      Code:
    $ man ls

  • Aliasing makes it much faster to type commands, especially if you use them with lots of flags frequently. The three lines show the prototype of the command, an example for human readable listings, and how to add it to your default settings (notice the double and single quotes here).
      Code:
    $ alias name=value
    $ alias lh='ls -lh --color=auto'
    $ echo "alias lh='ls -lh --color=auto'" >> ~/.bashrc

  • Background jobs will run a program without tying up the terminal (especially useful when launching programs like eclipse). N.B., the output of the program will still be printed to the screen, unless you redirect it.
      Code:
    $ eclipse &
    If you forget to start a program with the '&' you can hit Ctrl-z in the terminal to suspend the program, then type 'bg' to send it to background. 'fg' will return it to the foreground.

  • Want to know how much space a file or folder is using on the disk, or how much disk space is free? 'du' and 'df' will print the disk used and free, respectively. These command will print the space used by the current directory, and how much space is left on the disk where the directory is located with
      Code:
    $ du -hc --max-depth=0 *
    $ df -h ./
    You can also remove the human-readable flag (-h) and pipe to sort to quickly see what files/directories are taking up the most space:
      Code:
    $ du -cs * | sort -n
    $ du -csh * | sort -h // Human-readable numeric sort

From S12jrregner:
  • Enable syntax highlighting for CUDA files in Eclipse:
    Window -> Preferences -> in C/C++ -> File Types -> New
    Enter "*.cu" and select "C++ Source File"
    Repeat and enter "*.cuh" and select "C++ Header File"

  • Prevent Eclipse from complaining about __global__ and others:
    In your code, either include cuda_runtime.h or add the following:
      Code:
    #ifdef __CDT_PARSER__
    #define __global__
    #define __device__
    #define __shared__
    #endif
    See http://forums.nvidia.com/index.php?show ... &p=1249657 for a similar trick related to kernel invocations, but note that its use is discouraged.

  • Enable case-insensitive autocomplete in Bash:
      Code:
    $ echo "set completion-ignore-case on" >> ~/.inputrc
    If this doesn't take effect on your next login (it should on Euler):
      Code:
    $ echo "export INPUTRC=~/.inputrc" >> ~/.bashrc
    Alternatively, try a shell such as zsh which has even more powerful autocomplete capabilities (requests the change default shells must be sent to Andrew for the time being as chsh doesn't like LDAP). -aas

  • Append strings to a file without needing to \'escape\' \"quotes\":
      Code:
    $ cat >> somefile
    random string
    ^d
    where ^d is usually ctrl-d/EOF (end-of-file)

  • Create an empty file:
      Code:
    $ touch somefile
<<

S12nvandam

Newbie
Newbie

Posts: 17

Joined: Mon Jan 23, 2012 9:07 pm

Unread post Fri Feb 10, 2012 10:42 am

Re: Euler Tips & Tricks

Here're a couple things I found super useful to know when I first started using linux.

  • Manpages will explain the basics of what a command does and what all it's flags are. to read the man page for, e.g., ls
      Code:
    $ man ls

  • Aliasing makes it much faster to type commands, especially if you use them with lots of flags frequently. The three lines show the prototype of the command, an example for human readable listings, and how to add it to your default settings (notice the double and single quotes here).
      Code:
    $ alias name=value
    $ alias lh='ls -lh --color=auto'
    $ echo "alias lh='ls -lh --color=auto'" >> ~/.bashrc

  • Background jobs will run a program without tying up the terminal (especially useful when launching programs like eclipse). N.B., the output of the program will still be printed to the screen, unless you redirect it.
      Code:
    $ eclipse &

  • Want to know how much space a file or folder is using on the disk, or how much disk space is free? 'du' and 'df' will print the disk used and free, respectively. These command will print the space used by the current directory, and how much space is left on the disk where the directory is located with
      Code:
    $ du -hc --max-depth=0 *
    $ df -h ./
<<

S12jrregner

Newbie
Newbie

Posts: 29

Joined: Mon Jan 23, 2012 9:07 pm

Unread post Wed Feb 22, 2012 10:35 pm

Re: Euler Tips & Tricks

Syntax Highlight for CUDA files in Eclipse.

With Eclipse open:

Window -> Preferences -> in C/C++ -> File Types -> New -> enter " *.cu" and select "C++ Source File"

--source http://lifeofaprogrammergeek.blogspot.com/2008/07/using-eclipse-for-cuda-development.html
<<

S12jrregner

Newbie
Newbie

Posts: 29

Joined: Mon Jan 23, 2012 9:07 pm

Unread post Sun Mar 25, 2012 11:55 pm

Re: Euler Tips & Tricks

When using "tab" to complete your commands in the terminal, you don't have to type the command in the proper case if you use this tip:
Type the following commands at your terminal.
  Code:
cd ~
touch .inputrc

cat >> .inputrc
set completion-ignore-case on
^D

cat >>.bashrc
export INPUTRC=~/.inputrc
^D

(Note: ^D means press and hold the Ctrl key the press and release 'd'. This is the 'end of file' escape sequence. )
(cat >> fileName.txt , will append the following text to fileName.txt)

I guarantee this will make your terminal navigation, much faster.

Return to ME964 Spring 2012: High Performance Computing

Who is online

Users browsing this forum: No registered users and 2 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software.