Computer OS Commands

Published 10/27/2015 02:55:49 PM  |  Last update 12/13/2015 02:36:17 PM
Tags: website, linux, java, compiler

# Install ncftp client
apt-get install ncftp # Install compress tools
apt-get install unrar-free
apt-get install p7zip-full

# Download folder
ncftpget –R –v –u <ftpUser> <ftpServer>  client-path  server-folder-path
# Upload folder
ncftpput -R -v -u <ftpUser> <ftpServer>  server-path  client-folder-path

# Compression
tar -zcvf  [path]<compression-filename>.tar.gz   [path]<compressed-files>
# Decompression
tar -xzvf  [path]<compression-filename>.tar.gz

The later command extracts the entire compressed data, restoring folder structure as well.

# Compile standalone executable program for Java on Linux

# create a Java program
$ cat > <<'END'
public class Hello {
  public static void main(String args[]) {
    System.out.println("Hello, World!");
# install Java compiler
$ apt-get install gcj-jdk && gcj -v
# compile the Java program
$ gcj --main=Hello -g -o hello
# run the program
$ ./hello
Hello, World
# list Dynamic Dependencies of the program
$ ldd ./hello => /lib/ (0x007a2000) => /usr/lib/ (0x02e8f000) => /lib/tls/ (0x0063b000) => /lib/tls/ (0x00666000) => /usr/lib/ (0x0075b000) => /lib/ (0x00660000) => /lib/tls/ (0x00509000)
        /lib/ (0x004ef000) library needs to be shipped with the program. If you want it to be statically integrated into the program, please use -static-libgcj compile option. This option may not work on some Linux distros because the library is not included in the gcj package, then please try gcc instead. screen command

# start screen with a session name
screen -S <session-name>
# attach to a screen session
screen -r <session-name>
# open a screen window
screen -r <session-name> -t <window-name>
# send command to a screen window
screen -r <session-name> -p <windowID|window-name> -X stuff <command>
# quit a screen session
screen -X -S <session_name> quit

System states

# list running processes
ps -Awwo pid,comm,args
# get process ID
ps auxf | grep <program-file-name> | grep -v grep | awk '{print $2}'
pidof <program-name>
# check network
netstat -tap |grep LISTEN
netstat -a | egrep 'Proto|LISTEN'


  • problemFailed to open a secure file transfer session
  • Solution:
    • open: /etc/ssh/sshd_config
      check the parameter of sftp path which should point to an existing one:
      Subsystem sftp /usr/lib/openssh/sftp-server
  • restart ssh service
© 2023  by tinyray