Changes the directory
SYNOPSIS
cs [DIRECTORY]
DIRECTORY - Name of the directory you want to enter
cd .. - Go back from current directory
Examples
cd
This will move the current directory to home directory
cd../../
This will move current directory to two step back directory
cd ../root/misc
This will move current directory to one step back then the /root/misc directory
cd misc
This will move current directory to misc directory if available
Java J2ME JSP J2EE Servlet Android
UNIX Command: chmod
Changes the file or directory permission to a user, group or others
Synopsis
chmod [OPTION] .. MODE[,MODE] .. FILE ..
chmod [OPTION] .. OCTAL-MODE FILE ..
chmod [OPTION] .. --reference=RFILE FILE ..
Options
-c, --changes
like verbose but report only when a change is made
-f, --silent, --quiet
Suppress most error messages
-v, --verbose
Output a diagnostic for every file processed
--reference=RFILE
Use RFILE's mode instead of MODE values
-R, --recursive
Change files and directories recursively
--help
Display this help and exit
--version
Output version information and exit
Permissions
u - User who owns the file.
g - Group that owns the file.
o - Other.
a - All.
r - Read the file.
w - Write or edit the file.
x - Execute or run the file as a program.
Numeric Permissions:
CHMOD can also to attributed by using Numeric Permissions:
400 read by owner
040 read by group
004 read by anybody (other)
200 write by owner
020 write by group
002 write by anybody
100 execute by owner
010 execute by group
001 execute by anybody
Example
chmod 644 file.txt
This gives the file file.txt read/write by the owner and only read by everyone else (-rw-r--r--).
chmod 755 file.txt
Gives all the rights but the capability for anyone to edit tile.txt (-rwxr-xr-x).
chmod 666 file.txt
Gives read and right permission to everyone.
Synopsis
chmod [OPTION] .. MODE[,MODE] .. FILE ..
chmod [OPTION] .. OCTAL-MODE FILE ..
chmod [OPTION] .. --reference=RFILE FILE ..
Options
-c, --changes
like verbose but report only when a change is made
-f, --silent, --quiet
Suppress most error messages
-v, --verbose
Output a diagnostic for every file processed
--reference=RFILE
Use RFILE's mode instead of MODE values
-R, --recursive
Change files and directories recursively
--help
Display this help and exit
--version
Output version information and exit
Permissions
u - User who owns the file.
g - Group that owns the file.
o - Other.
a - All.
r - Read the file.
w - Write or edit the file.
x - Execute or run the file as a program.
Numeric Permissions:
CHMOD can also to attributed by using Numeric Permissions:
400 read by owner
040 read by group
004 read by anybody (other)
200 write by owner
020 write by group
002 write by anybody
100 execute by owner
010 execute by group
001 execute by anybody
Example
chmod 644 file.txt
This gives the file file.txt read/write by the owner and only read by everyone else (-rw-r--r--).
chmod 755 file.txt
Gives all the rights but the capability for anyone to edit tile.txt (-rwxr-xr-x).
chmod 666 file.txt
Gives read and right permission to everyone.
UNIX Command: cat
cat is one of the most flexible command of UNIX. It can be used to create, concat and view file.
Sysnopsis
cat [OPTION] [FILE]
DESCRIPTION
Example: Create a new file address
cat >address
Sharif R#67, Dhaka -1207
Mizan R#123, Rajshahi
Example: To view the file addreaa
cat address
Example: Add text to addreaa
cat >>address
Shaila Godagari, Rajshahi
Example: To concat a file temp to another
cat temp>>address
Options
-e Print $ at the end of each line. This option must be used with -v.
-s Suppress messages pertaining to files that do not exist.
-t Display tab as ^I and form feed as ^L. This option must be used with -v.
-u Print output as unbuffered.
-v Display control characters and nonprinting characters
Sysnopsis
cat [OPTION] [FILE]
DESCRIPTION
Example: Create a new file address
cat >address
Sharif R#67, Dhaka -1207
Mizan R#123, Rajshahi
Example: To view the file addreaa
cat address
Example: Add text to addreaa
cat >>address
Shaila Godagari, Rajshahi
Example: To concat a file temp to another
cat temp>>address
Options
-e Print $ at the end of each line. This option must be used with -v.
-s Suppress messages pertaining to files that do not exist.
-t Display tab as ^I and form feed as ^L. This option must be used with -v.
-u Print output as unbuffered.
-v Display control characters and nonprinting characters
UNIX Common Shell Commands
Here are the commonly used UNIX shell commands
balance:
Lists remaining money in account
cat > filename
Easy way to create a file.
cat file1 >> file2
Concatenates file1 on the end of file2
cd newdir
Change current directory to "newdir"
correct filename
Corrects spelling of text in "file"
cp filename newfilename
Makes a copy of a file
date
Gives date and time
finger
Gives names & account numbers of current logins
frm
Shows who mail is from
from
shows who mail is from
help
Tells about on-line help
logout
When you are finished working
look [string]
Finds all words that match string
ls
Lists contents of current directory
mail
To read mail
mail usename
Sends mail to "user"
mkdir directory.name
Makes a directory
more filename
Prints file on screen one page at a time
mv file1 file2
Changes name of file1 to file2
passwd
Changes password
pwd
"print working directory" - Shows working directory name
quota -v
Shows account disk-space use
rm
Removes a file
tset [type]
Tells computer what type of terminal you are using
uptime
Shows number of users and load on machine
vi filename
Creates or opens file for editing
webster [word]
Gives definition, pronunciation and etymology of "word"
balance:
Lists remaining money in account
cat > filename
Easy way to create a file.
cat file1 >> file2
Concatenates file1 on the end of file2
cd newdir
Change current directory to "newdir"
correct filename
Corrects spelling of text in "file"
cp filename newfilename
Makes a copy of a file
date
Gives date and time
finger
Gives names & account numbers of current logins
frm
Shows who mail is from
from
shows who mail is from
help
Tells about on-line help
logout
When you are finished working
look [string]
Finds all words that match string
ls
Lists contents of current directory
To read mail
mail usename
Sends mail to "user"
mkdir directory.name
Makes a directory
more filename
Prints file on screen one page at a time
mv file1 file2
Changes name of file1 to file2
passwd
Changes password
pwd
"print working directory" - Shows working directory name
quota -v
Shows account disk-space use
rm
Removes a file
tset [type]
Tells computer what type of terminal you are using
uptime
Shows number of users and load on machine
vi filename
Creates or opens file for editing
webster [word]
Gives definition, pronunciation and etymology of "word"
Java : JTable example
Here is a simple java JTable example
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ScrollPaneLayout;
public class MyFrame extends JFrame implements ActionListener{
JButton button = new JButton("Press me");
JScrollPane scrollpane = null;
Vector c = new Vector();
Vector r = new Vector();
Vector rs = new Vector();
JTable table = null;
public MyFrame() {
c.add("Name");
c.add("Age");
r.add("Sharif");
r.add("28");
rs.add(r);
r.add("Shaila");
r.add("23");
rs.add(r);
table = new JTable(rs,c);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 400, 400);
setLayout(new GridLayout(0,1));
scrollpane = new JScrollPane(table);
}
public void init(){
button.addActionListener(this);
getContentPane().add(button);
getContentPane().add(scrollpane);
setVisible(true);
}
public static void main(String args[]) {
MyFrame frame = new MyFrame();
frame.init();
}
public void actionPerformed(ActionEvent ac) {
System.out.println(ac.getSource());
}
}
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ScrollPaneLayout;
public class MyFrame extends JFrame implements ActionListener{
JButton button = new JButton("Press me");
JScrollPane scrollpane = null;
Vector c = new Vector();
Vector r = new Vector();
Vector rs = new Vector();
JTable table = null;
public MyFrame() {
c.add("Name");
c.add("Age");
r.add("Sharif");
r.add("28");
rs.add(r);
r.add("Shaila");
r.add("23");
rs.add(r);
table = new JTable(rs,c);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 400, 400);
setLayout(new GridLayout(0,1));
scrollpane = new JScrollPane(table);
}
public void init(){
button.addActionListener(this);
getContentPane().add(button);
getContentPane().add(scrollpane);
setVisible(true);
}
public static void main(String args[]) {
MyFrame frame = new MyFrame();
frame.init();
}
public void actionPerformed(ActionEvent ac) {
System.out.println(ac.getSource());
}
}
Subscribe to:
Posts (Atom)