Saturday, December 15, 2012

Linux: Basic Commands via Putty

cd
Change directory
pwd
To find the exact directory you are in type the command
cd ~/dir1
To navigate to a sub-folder in your home directory
  • i.e. cd /home/keith/dir1 = cd ~/dir1
cd ..
Previous folder (Go back)
rm
Remove file
rm -r
Remove folder
  • i.e. rm -r folder_name
rm -rf FILE_NAME
Force remove folder
  • rm -rf FILE_NAME
tar cvzf
Zip/Archive folder
  • i.e. tar cvzf Target_File_Name.tar.gz   Source_File_Name
tar xvfz
Unzip/Unarchive folder
Unzip
Unzip File_Name.zip - to unarchive .zip files
  • i.e. unzip filesample.zip
Zip -r
Archive folder with .zip extension.
  • i.e. zip  -r  Target_FolderName.zip  Source_FolderName
mv
Move folder/file
  • i.e. mv [file_name] ./[location]
  • Mv file_name ./.. - move to previous directory folder
MV comman is also used to rename file name
  • i.e. if I want to rename FILE into FILE1, the command is:
    • mv Current_File_Name New_File_Name
/sbin/ifconfig
To view IP addresses and configurations (similar to Windows ipconfig)
vi
View editor. Once you are on view editor mode, press i to insert and navigate the cursor with keyboard arrows to edit the content.
 :wq!
Save and Quit view editor mode.
:q!
Quit editor mode without saving the changes.
cat OR less
File viewer without editing privilege .
scp -r
Server copy file - to copy file from server to server or other directories
  • i.e. scp -r filename* user@servername:/directory
    • * - indicates to copy all content inside a folder
    • User - previleged user at target server
    • @servername - where the file will be copied to
    • :/directory - file path to paste the copied files
  • Follow instructions on screen afterwards.
ps -x
View running services / processes
kill -9 [PID#]
Kill process by force
  • You can perform this task after ps -x (view running processes)
  • i.e. kill -9  12345
tail -100f [log path]
Read last 100 rows of a file.
  • i.e. tail -100f /home/file/abc.log
Note: press Ctrl+C to exit tail view.
nohup
Run service/process in the background
  • i.e. navigate to the path where you want to execute the process:
    • nohup ./service_name &
export VAR_ENVR_NAME=
To set Variable Environment
  • i.e.  export ORACLE_HOME=/user/Middleware/OBIEE11g
echo "$VAR_NAME"
View current variable environemtn
  • i.e.  Echo "$ORACLE_HOME"
scp file_name user_name@server_name:path
Copy files from one user to another
  • i.e. scp file_name user_name@server_name:/directory_path
sudo su - username

cp *
Copy all from current file into target_path
  • i.e. cp * /home/user
If you have multiple files that starts with the same syntax, i.e. file1, file2, file3 -then you can use this command:
  •  cp file* /home/user
    • This will move all files that names start with file
vi filename
Creates a new file
cp /home/vizid/filename . 
. Represents current directory
top
View running services
./opmnctl startproc ias-component=COMPONENT_NAME
To start/stop individual OBIEE OPMN services, this command is used
touch
Create new file (.txt)
  • i.e. touch FILE_NAME
Df
Check hard disk space
du -sh
Check folder usage space
  • du -sh Folder_Name
Free -g
Check server RAM / Memory usage
./opmnctl stopproc ias-component=coreapplication_obips1
Stopping one BI service at a time
find . -name SEARCH_TERM*
Will search all subordinate folders from current directory

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.