MMM
Results 1 to 25 of 595

Thread: The Linux Help and Tutorial Thread

Threaded View

  1. #1
    Xtreme Cruncher
    Join Date
    Jan 2009
    Location
    Nashville
    Posts
    4,162

    The Linux Help and Tutorial Thread

    I thought I would start this thread for all those who are using or want to use Linux for a cruncher and are new to the OS. Those that are experienced with Linux/UNIX can offer the commands and tools they have found the most useful in installing and maintaining a Linux Cruncher.

    While there are many useful GUI tools the real strength of Linux/Unix and the most intimating and confusing are the command line tools.

    Keeping in mind this is focused on crunching please add whatever commands you have found helpful.

    I will start off recommending this book UNIX In A Nutshell. Commands are grouped and referenced by task and cross referenced and there is a keyword index. Also has example command lines. Although at 908 pages not a lightweight.

    Online Linux Tutorials and Knowledge Base:
    Linux Knowledge Base and Tutorial
    Getting Started with Linux - Course Material
    Linux Terminal Command Reference


    This thread assumes a Debian/Ubuntu based Linux Distro. All command line examples should work on Ubuntu, Mint, Kubuntu and more.

    Start here:
    How To Open Terminal and Use The Command Line

    My most used commands:

    top
    A command line task manager like program displaying memory and CPU usage, tasks running, uptime, CPU load, virtual memory, swap space and more.

    tail
    tail -f /var/log/syslog
    will show the last 10 lines of the system log and any new lines written to the file in real time. tail, without -f will show the last 10 lines and exit.
    tail - 100 /var/log/kern.log | more
    show the last 100 lines of kern.log a page at a time. Q to quit, B to scroll back one page, space to go to next page.

    grep
    grep error /var/log/syslog
    Find the word error in syslog and display all lines containing it.
    grep error /var/log/syslog | more
    Find the word error in syslog and display all lines containing it a page at a time.

    sudo cat filename | more
    To view a file a page at a time with no editing.

    uname -a
    Displays info concerning the kernel version, useful if there are issues with certain kernel builds.

    uptime
    Show time since last bootup, CPU load averages. Top also displays this info.

    dmesg | more
    dmesg displays bootup info and more displays it a page at a time. This is when the OS is doing hardware detection and will show if a piece of hardware was detected by the OS. Helpful when determining what a NIC card or wireless card is not working and if you need to get a driver not supplied by your linux distro.

    free
    Ram memory and swap usage.

    du
    Shows disk usage by directory.
    du /var/tmp
    Shows Disk Usage for directory /var/tmp

    df -H
    Disk free.

    ls -la
    List files. -a show hidden files that start with a period. -l show long display.
    ls alone lists files and directoies only.

    cd /var/tmp
    Change Directory to /var/tmp

    cd /
    Change Directory to the root directory /

    cd ..
    Change Directory to one below current.

    pwd
    Present Working Directory

    Get name of current directory and change to directory below it.
    pwd
    /var/tmp
    cd ..
    pwd

    /var

    Change to my home directory using cd ~ or cd
    cd ~
    cd
    pwd
    /home/poppageek

    If you think your hard disk needs to be checked for errors:
    sudo touch /forcefsck reboot the PC
    This will force a check for disk errors on next reboot.

    To find a file or directory named boinc-client starting in the / root directory
    sudo find / -name boinc-client -ls

    When at the command line you can use the up arrow key to scroll through the command buffer or history. Handy for reviewing and re-entering earlier commands.
    ls
    pwd
    cd /var/tmp
    Up Arrow Key

    cd /var/tmp
    Up Arrow Key
    pwd
    Up Arrow Key
    ls

    You can use the Tab key to complete a file name or directory name that is in the current directory.
    cd /etc/boi <tab key>
    cd /etc/boinc-client <enter key>
    pwd
    /etc/boinc-client
    ls -la
    drwxr-xr-x 2 root root 4096 2010-10-30 19:01 .
    drwxr-xr-x 129 root root 12288 2010-10-08 03:26 ..
    -rw-r--r-- 1 root boinc 1276 2010-09-10 07:23 cc_config.xml
    -rw-rw-r-- 1 root boinc 1290 2010-09-13 23:21 global_prefs_override.xml
    -rw-r----- 1 root boinc 0 2010-10-30 19:01 gui_rpc_auth.cfg
    -rw-r--r-- 1 root boinc 310 2010-09-10 05:22 remote_hosts.cfg
    tail glob <tab key>
    tail global_prefs_override.xml <enter key>
    last 10 lines displayed of global_prefs_override.xml

    -------------------------------------------------------------------------------------------------------------------------------
    All files are owned by a user registered in the system password and group files. TO be able to Read a file you need read permission if you are not the owner. The same to be able to write to a file or edit it. If you down load the boinc archive from Berkely you need to be able to execute it.

    Get a directory listing of directory currently in:

    Code:
    ls -la
    drwxr-xr-x 2 poppageek poppageek    4096 Nov 11 14:50 Music
    drwxr-xr-x 2 poppageek poppageek    4096 Nov 12 02:56 personalVPN
    drwxr-xr-x 2 poppageek poppageek    4096 Nov 11 14:50 Pictures
    drwxr-xr-x 2 poppageek poppageek    4096 Nov 11 14:50 Public
    drwxr-xr-x 2 poppageek poppageek    4096 Nov 11 14:50 Templates
    drwxr-xr-x 7 poppageek poppageek    4096 Nov 11 21:19 tor-browser_en-US
    drwxr-xr-x 2 poppageek poppageek    4096 Nov 11 14:50 Videos
    -rw-r--r--  1 poppageek poppageek     675 Nov 11 14:45 .profile
    Files preceded by a period are usually important configuration files and should be left alone unless you are sure what you are doing.

    In the row of the listing above the d means directory. Then we have 3 sets of letters or dashes. first 3 are owner, second 3 are group and last 3 are world. so the Public directory has rwx, Read Write eXecute permissions set or enabled for user or owner of Public, poppageek. The next 3 are -xr which means write is NOT allowed, eXecute is allowed and Read is allowed.

    My .profile has no eXecute permissions but does have Read and Write for the owner and Read for group and world. The first poppageek is owner the second is group. A user can belong to more than one group. To see what groups you are in:

    Code:
    groups
    To change the ownership:

    Code:
    sudo chown newuser:newgroup .profile
    sudo chown boinc:boinc cc_config.xml
    Changes the cc_config.xml to be owned by user boinc in group boinc.

    To change permissions we will add group and world read to Public. Then remove eXectue to Templates for world

    Code:
    sudo chmod gw+r Public
    
    sudo chmod w-x Templates
    To make a new empty file then add world Read, Write and eXecute then add group eXecute.

    Code:
    sudo touch newfile1
    sudo chmod w+rwx newfile1
    sudo chmod g+x newfile
    More on how to get around the file structure and editing the command line.
    ---------------------------------------------------------------------------------------------
    How to create and edit files using the GEdit Text Editor.
    This is like Windows Notepad and just as simple. I will use the Boinc config files gui_rpc_auth.cfg and remote_hosts.cfg as examples.

    Applications > Accessories > Terminal When terminal opens type the following then hit enter: sudo /usr/bin/gedit Enter your password. gedit should now be open.

    For Boinc installed from the command line using apt-get:
    Click on Open then in the left column click on File System on right column double click on etc scroll down to boinc-client and double click.

    For Boinc installed from download:
    Click on Open then in the left column click on File System on right column double click on home scroll down to your login name and double click and double click on BOINC.

    For Dotsch Boinc/Linux installs:
    Click on Open then in the left column click on File System on right column double click on home scroll down to boinc and double click and double click on BOINC.

    If Boinc was installed another way just replace the directory names above with the location your config files are in.

    If you are in the correct directory now, depending on the way Boinc was installed, you should see gui_rpc_auth.cfg in the right column. Double click on gui_rpc_auth.cfg. On my install the file is empty. If there is anything shown in the window delete it all using the Backspace or Delete keys. Now click on Save. Now File > Close.

    Now click on File > Open or the Open Icon. Double click on remote_hosts.cfg. If remote_hosts.cfg is not listed then click on Cancel at bottom right corner. Then click on File > New. Go to the end of the file and type in the IP number of the machine that BoincTasks is running on. After entering the information click on save and enter the file name. In this case remote_hosts.cfg. Make sure the correct directory is in the box under the filename, else choose the correct directory by selecting File System which will open a directory browser. You can restart Boinc or reboot the machine. BoincTask should see your Linux cruncher now.

    If BoincTasks does not see your Linux machine click on the Computers tab then click on Computer on the task bar and select Find Computers. Narrow down the IP range to cover the IPs of any machines you want to add. If left at default it will scan the entire 256 range and take a while. Scan Address Range and Find use different methods and are not the same. Once listed select and click Add Computer.
    ---------------------------------------------------------------------------------------------

    Basic commands for using the Visual Editor a non-gui terminal editor

    vi somefilename

    a
    Append, the characters typed in will be inserted after the current cursor position.

    i
    Enter insert mode, the characters typed in will be inserted before the current cursor position.

    dd
    Delete line.

    o
    Open a new line after current line

    j or down arrow key.
    move the cursor down one line.

    k or up arrow key.
    move the cursor up one line.

    l or right arrow key.
    move the cursor to the right one character position.

    h or left arrow key
    Move the cursor to the left one character position.

    r
    replace one character under the cursor.

    u
    undo the last change to the file. Typing u again will re-do the change.

    x or Del key.
    Delete character under the cursor.

    :q quit
    :q! force quit not saving changes
    :w write file
    :wq write file and quit

    VI cheat sheet Extensive vi command reference.

    __________________________________________________ ______________________

    For GPU projects:

    If Boinc claims it does not see a GPU on reboot
    __________________
    Last edited by PoppaGeek; 01-02-2014 at 10:04 AM.

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •