WebSphere Issues

01/04/2010

Linux commands

Filed under: Commands, Linux — Ishtiaque @ 12:08 pm

Sudo:

  • sudo -i, su – (Sudo to root)
  • su – myuser
  • sudo ls / (Run a command as sudo user)
  • echo “user1 ALL=(ALL) NOPASSWD: ALL” > /etc/sudoers.d/user1; chmod 440 user1

Shutdown and Reboot:

  • poweroff , shutdown -h now
  • reboot, shutdown -r now

Copy and Move, Delete:

  • cp src.txt dest.txt
  • mv org.txt renamed.txt
  • rm -rf mydir, myfile

SCP commands:

  • scp file.txt root@myhost:/opt
  • scp -r dir root@myhost:/opt
  • scp root@remhost:/opt/file1.txt /opt/files/ (Copy from remhost to localhost)
  • scp -r root@remhost:/opt/dir1/ /opt/   (Copy dir1 from remhost to localhost)

SSH commands:

  • ssh root@host1
  • ssh -i my.key root@host1

Chmod and Chown  (Read=4, Write=2, Execute=1):

  • chmod 777 file.txt
  • chmod a+x file.sh (u=user, g=group, o=others, a=all)
  • chmod a-x file.sh (Remove execute permission for all)
  • chown user1 file1.txt

User and Groups:

  • useradd -d /home/user1 user1
  • groupadd grp1; useradd -g grp1 user1 OR useradd -G grp1,grp2 user1
  • userdel –remove user1 OR deluser –remove-home user1 (Ubuntu)
  • passwd user1
  • cat /etc/group|grep grp1
  • cat /etc/passwd|grep user1

Disk Partition and Usage:

  • fdisk -l
  • lsblk
  • df -h
  • du -sh /opt/dir1  (Directory usage)
Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: