تشفير ملف في لينكس

يمكنك تشفير أي ملف في لينكس من خلال “اداة حماية الخصوصية من جنو” GnuPG. لتشفير ملف معين (فرضاً passwds.txt)، إدخل الأمر التالي:

gpg -c passwds.txt

إستخدمنا ‘-c’ لإدخال كلمة السر يدويا. عند الإنتهاء من هذه العملية، سيكون عندك ملف بإسم ‘passwd.txt.gpg’ و هو عبارة عن الملف المشفر.

عندما يقوم gpg بتشفير الملف، سيقوم بإنشاء ملف جديد ليحوي المعلومات المشفرة. gpg لن يمس الملف الأصلي. و تقع المسؤلية إزالة الملف القديم على المستخدم!

لفك التشفير، إستخدم الأمر التالي:

gpg passwd.txt.gpg

إنظر الى man gpg لمزيد من المعلومات.

Rotating X in Linux

Rotating the screen in GNU/Linux running X11 can be accomplished by: لتغيير توجه شاشة العرض في لنكس (خاص بX11 مثل Xorg):


xrandr -o orientation

Where orientation can be normal, right, left, inverted.
See man 1 randr
حيث ‘orientation’ تستبدل بأحد الخيارات التالية:

normal توجه طبيعي
inverted مقلوب
right 90 درجة الى اليمين
left 90 درجة الى اليسار

لمزيد من المعلومات، إقراء man 1 xrandr

Fixing Arabic Encoding in Firefox

To fix Arabic encoding errors in firefox, go to: لإصلاح مشكلة الخطوط العربية في فاير فوكس التي تطرء ببعض المواقع، أتبع سلسلة القوائم التالية (من شريط القوائم):

View » Character Encoding » Arabic (Windows-1256)

How to enable 3D chess view in Gnome’s glChess (Ubuntu)

Open a Terminal and type:
sudo apt-get install python-opengl python-gtkglext1

Then open/restart glChess.

How to update grub menu in linux

Open a Terminal and type:
sudo grub-mkconfig

Notes:

  • update-grub and update-grub2 should do the same job; both of these commands are based on the command grub-mkconfig.

How to switch between tabs in gedit using the keyboard

To switch between tabs, press Ctrl+Alt+PgUp or Ctrl+Alt+PgDn. To close a tab, hit Ctrl+w.

How to shutdown ubuntu from the command line

To shutdown ubuntu, type:
sudo shutdown -h 0

This command can be used for other purposes such as rebooting the system (-r). The 0 indicates the amount of time before the systems starts to shutdown which can be an integer or the string now.
see man 8 shutdown

Converting a string to an Integer in C

To convert any char string to an integer, include stdlib.h and use the function:
int atoi(const char *nptr);
see man 3 atoi

/*example*/
#include <stdlib.h>
int main(int argc, char **argv){
	return(atoi(argv[1]));
}
/*check the return status (for linux/bash: echo $? )*/

How to run Java applets in a web-browser (Ubuntu)

Open a Terminal and type:
sudo apt-get install sun-java6-plugin

To install Java fonts (optional):
sudo apt-get install sun-java6-fonts

Sending notifications and other messages to your desktop

To send messages to your desktop (which appear as simple notifications), use notify-send (ubuntu users: sudo apt-get install libnotify-bin).
To send a message, run the following:

notify-send "message"

Example: you can use notify-send to script a little timer:
sleep 5m; while [ 1 ]; do notify-send "Time's up"; sleep 1; done
This script will wait 5 minutes, then display up to seven notice bubbles (at a time) on your screen indicating that “Time’s up”

This has been tested with gnome and might work with other desktop environments.