Basic Netezza Linux Commands to Learn Netezza

  • Post author:
  • Post last modified:February 28, 2018
  • Post category:Netezza
  • Reading time:5 mins read

In this post you will learn about some basic Netezza Linux commands. As you know, Netezza is Linux based data warehouse appliance that doesn’t have any UI. To get started you need to know some basic Netezza Linux commands to move through the Linux directories, find files, find directory size, create folders, create folders, and use some standard file editor to create file.

Read:

Basic Netezza Linux Commands

Here are the quick and lists of basic Netezza Linux commands that are frequently used when working with Netezza data warehouse appliance:

  • pwd
    • Display current working directory
  • who
    • show who is logged on
  • ssh username@Netezza_server
    • Connect to Netezza server using SSH
  • ls (ls -l)
    • list the contents of the current directory
  • cd <directory name>
    • change directory to the directory name given
  • cd ..
    • go up one parent directory
  • cp /src_loc/<file> /dest_loc/<file>
    • copy
  • mkdir <directory name>
    • Create directory or folder
  • rm -rf <file or directory>
    • Force and recursive delete directory or file
  • mv /loc/<file> <directory>
    • move a file or directory to named directory
  • rm <file>
    • Remove file. Careful while using rm as you cannot undo the delete
  • df -h
    • Find out the size of data file directories
  • du -a /<directory> | sort -n -r | head -n 10 –
  • du -cks * | sort -rn | head
    • Find out top 10 largest folders
  • nzsql -u <username> -pw <password> -host <hostname or IP> -db <Database>
    • Connect to Netezza server from Linux box
  • nzload -u <username> -pw <password> -host <hostname or IP> -db <Database> -df <data file> -lf <log file> -bf <bad file>
    • Load data to Netezza data warehouse
  • scp <file> user_name@target.com:/<directory>
    • Copy file from one server to other server
  • dos2unix <file>
    • Convert file from ASCII to UTF-8
  • FTP or SFTP
    • Transfer file from one server to other server
  • head -10 <file>
    • Display first 10 lines from file
  • tail -10 <file>
    • Display last 10 lines from file
  • find / -name “file-name”
    • Find the particular file
  • cat <file>
    • Display the content of file
  • grep – cat <file> | grep ‘anything’
    • Prints line matching pattern
  • touch <filename>
    • Create empty file
  • vi <filename>
    • Edit or create file using vi editor
  • mount <directory>
    • Allows you to use directory in Linux operating system
  • zip and unzip
    • Zip and unzip files
  • echo
    • Display a line of text
  • wc -l <file>
  • wc
    • Print number of newlines, words in the file
  • sort <file>
    • sorts lines of text
  • chmod <options> <mode> <file>
    • Change file permissions
  • chown <options> … OWNER
    • Change file owner
  • ps -ef
    • check the process running on system
  • kill <PID>
    • Kill a process
  • top
    • Shows the CPU utilization
  • tar
    • Archive a file e.g. tar -xvf file_name.tar

Learn all these basic commands, but there are many commands that make working with Linux much easier and some of those are necessary for expanding Netezza’s functionality.

Shell Scripting

Learn some of the basics of shell script programming (aka shell scripting). Shell script is powerful programming available under the Bourne shell (BASH).

Sample Shell Script

#!/bin/sh
echo "Hello World"
# Execute SQL script file from shell script
nzsql -c "select * from table"
#end of script

Save this to myShell.sh and execute it like ./myShell.sh. There are lot of online tutorials available to learn shell script.