Archive for the 'linux' Category
The similar question you may ask:
- How to know my Linux server is running in 64/32 bits?
- How to check which kernel version is my Linux?
- How to show the Linux release name? Is it Ubuntu?Redhat or CentOS or something else?
In work, we have many different linux servers either in physical machine or virtual machine (Using Xen/KVM). Sometimes we easily lost track of which linux version is installed for Server A, B, and other.
There are few simple command to check for which Linux version you were using:
To show the linux release information as per LSB specification
sudo lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 8.04
Release: 8.04
Codename: hardy
To show the Linux kernel build and version
cat /proc/version
Linux version 2.6.24-19-xen (buildd@king) (gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu7)) #1 SMP Sat Jul 12 00:15:59 UTC 2008
The other commands is to show the kernel version and type:
uname -a
Linux penguin 2.6.24-19-xen #1 SMP Sat Jul 12 00:15:59 UTC 2008 x86_64 GNU/Linux
There was a time I would like to check what are the task/job configured in crontab of all users. After I googled it I found this scripts from StackOverflow
You must run this script as root.
for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done
What does it do? This script basically loop thru /etc/passwd to get the user id and call ‘crontab -l’ for each user. A nice script to share and also I would like to keep it here so easy for me to refer next time.
During work, every time when I want to create a new sub-project (which has similar folder structure with existing one) I need to create the folder one by one. I cannot just copy-paste the sub-project1 folder and renamed it to sub-project2 because it contains hidden .svn which is used to track the version of sub-project1.
project - sub-proj1 - - src - - - - main - - - - - - java - - - - - - resource - - - - - - webapp - - - - - test - sub-proj2 - - - - main - - - - - - java - - - - - - resource - - - - - - webapp - - - - - test
So… how do I get rid of hidden .svn folder/files when copying from sub-project1 to a new sub-project?
rsync -r --exclude=.svn SRC_FOLDER DESTINATION FOLDER
example:
rsync -r --exclude=.svn /root/project/sub-proj1/ /root/project/sub-proj2/
Hope this would help!





