-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathubuntu commands
418 lines (360 loc) · 15.1 KB
/
ubuntu commands
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
Helpful Uubntu commands:
Privileges
sudo command - run command as root
sudo su - open a root shell
sudo su user - open a shell as user
sudo -k - forget sudo passwords
gksudo command - visual sudo dialog (GNOME)
kdesudo command - visual sudo dialog (KDE)
sudo visudo - edit /etc/sudoers
gksudo nautilus - root file manager (GNOME)
kdesudo konqueror - root file manager (KDE)
passwd - change your password
install wine:sudo aptitude install wine playonlinux
Display
sudo /etc/init.d/gdm restart - restart X (GNOME)
sudo /etc/init.d/kdm restart - restart X (KDE)
(file) /etc/X11/xorg.conf - display configuration
sudo dpkg-reconfigure -phigh xserver-xorg - reset X configuration
Ctrl+Alt+Bksp - restart X display if frozen
Ctrl+Alt+FN - switch to tty N
Ctrl+Alt+F7 - switch back to X display
System Services¹
start service - start job service (Upstart)
stop service - stop job service (Upstart)
status service - check if service is running (Upstart)
/etc/init.d/service start - start service (SysV)
/etc/init.d/service stop - stop service (SysV)
/etc/init.d/service status - check service (SysV)
/etc/init.d/service restart - restart service (SysV)
runlevel - get current runlevel
Package Management¹
apt-get update - refresh available updates
apt-get upgrade - upgrade all packages
apt-get dist-upgrade - upgrade Ubuntu version
apt-get install pkg - install pkg
apt-get remove pkg - uninstall pkg
apt-get autoremove - remove obsolete packages
apt-get -f install - try to fix broken packages
dpkg –configure -a - try to fix broken packages
dpkg -i pkg.deb - install file pkg.deb
(file) /etc/apt/sources.list - APT repository list
Network
ifconfig - show network information
iwconfig - show wireless information
sudo iwlist scan - scan for wireless networks
sudo /etc/init.d/networking restart - reset network
(file) /etc/network/interfaces - manual configuration
ifup interface - bring interface online
ifdown interface - disable interface
Special Packages
ubuntu-desktop - standard Ubuntu environment
kubuntu-desktop - KDE desktop
xubuntu-desktop - XFCE desktop
ubuntu-minimal - core Ubuntu utilities
ubuntu-standard - standard Ubuntu utilities
ubuntu-restricted-extras - non-free, but useful
kubuntu-restricted-extras - KDE of the above
xubuntu-restricted-extras - XFCE of the above
build-essential - packages used to compile programs
linux-image-generic - latest generic kernel image
linux-headers-generic - latest build headers
Firewall¹
ufw enable - turn on the firewall
ufw disable - turn off the firewall
ufw default allow - allow all connections by default
ufw default deny - drop all connections by default
ufw status - current status and rules
ufw allow port - allow traffic on port
ufw deny port - block port
ufw deny from ip - block ip adress
Application Names
nautilus - file manager (GNOME)
dolphin - file manager (KDE)
konqueror - web browser/filemanager (KDE)
kate - text editor (KDE)
gedit - text editor (GNOME)
System
Recovery - Type the phrase “REISUB” while
holding down Alt and SysRq (PrintScrn) with
about 1 second between each letter. Your system
will reboot.
lsb_release -a - get Ubuntu version
uname -r - get kernel version
uname -a - get all kernel information
If GRUB is corrupted :
http://ubuntuforums.org/showthread.php?t=224351
To know all commands in Terminal, press tab twice in terminal.
To read and write ntfs:
sudo aptitude install ntfs-config
__________________
what is beautiful is not always good, but what is good is always beautiful!
When I'm right no one remembers..When I'm wrong no one forgets..
ubuntu server commands 10.10
This will give you a basic GUI:sudo apt-get install xorg gdm gnome-core gnome-themes
If you want the full desktop including all the appps you'd get on the desktop edition, then use:sudo apt-get install xorg ubuntu-desktop
http://blog.sudobits.com
*******************************************************to stop apt-get threads in system!!!***************************************************************
ps ax | grep dpkg
ps -e | grep apt (might show you a number which is essentially a job number. My system was locked due to apt-get and showed me apt-get as job number 1594)
database area is locked by another process
sudo rm /var/lib/dpkg/lock
sudo kill 1594 (modify number to your current run)
killall aptitude && killall apt-get
killall dpkg && killall frontend
This works perfect without having to delete the lock and causing unnecessary changes to your system
**********************************************************************************************************************************************************
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
EASY ECLIPSE FOR PHP
: JVM terminated with eclipse 3.2
I have found some workaround... and should work without problems.
1. Install Java enviroment:
$ sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk sun-java6-plugin
2. Update alternatives:
$ sudo update-java-alternatives -s /usr/lib/jvm/java-6-sun
3. Install eclipse:
$ sudo apt-get install eclipse
4. Once that Eclipse IDE is installed, download Easyeclipse and extract the contents of the tar file:
tar -zxvf Desktop/easyeclipse-lamp-1.2.2.2.tar.gz
5. Finally copy al the contents of easyeclipse-lamp-1.2.2.2/plugins to /usr/local/lib/eclipse/plugins/
And that's it! You got Eclipse with all the functionality of Easyeclipse for LAMP (or whatever the flavor you need).
Best!
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if dpkg interuppted,
sudo dpkg --configure -a
sudo dpkg --configure -a
--------------------------
to auto start lampp on ubuntu
sudo ln -s /opt/lampp/lampp /etc/init.d/lampp
sudo update-rc.d -f lampp defaults
==================================
TO CHANGE USERNAME
gksudo gedit /etc/hostname
gksudo gedit /etc/hosts
==============================
architecture
uname --all
uname --machine
lshw
---------------------------
install .deb files
sudo dpkg -i <nameofthepackage>.deb
==============================
sh winetricks
////////////////////////////////
update-alternatives: using /usr/bin/php5 to provide /usr/bin/php (php) in auto mode.
---------------------------------------------------
lynx -source http://pear.php.net/go-pear | php
______________________________________
to install libXext
sudo apt-get install libxext-dev autoconf automake build-essential
+++++++++++++++++++++++++++++++++++++++++++++
sudo apt-get install libzzip-dev
----------------------------
./configure --without-arts
------------------------
install samba server on ubuntu
sudo apt-get install samba smbfs
sudo gedit /etc/samba/smb.conf
Find this section in the file:
####### Authentication #######
# “security = user” is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba-HOWTO-Collection/ServerType.html
# in the samba-doc package for details.
; security = user
Uncomment the security line, and add another line to make it look like this:
security = user
username map = /etc/samba/smbusers
--------------------------------------------------------------------
./configure --without-arts --prefix=$KDE_PREFIX --sysconfdir=/etc/kde \
--disable-debug --disable-dependency-tracking &&
make
-------------------------
./configure===to configure the package for your system.
make===compile the package
make check===run any self-tests that come with the package
make install===to install the programs and any data files and documentation
make clean===remove the program binaries and object files from the source code directory
make distclean===remove the files that `configure' created (so you can compile the package for a different kind of computer)
make maintainer-clean===intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came
with the distribution.
=============================================
ftp://ftp.kde.org/
===========================================
tar -C /myfolder -zxvf yourfile.tar.gz
=========================================
-rw------- 1 bshotts bshotts 576 Apr 17 1998 weather.txt
drwxr-xr-x 6 bshotts bshotts 1024 Oct 9 1999 web_page
-rw-rw-r-- 1 bshotts bshotts 276480 Feb 11 20:41 web_site.tar
-rw------- 1 bshotts bshotts 5743 Dec 16 1998 xmas_file.txt
---------- ------- ------- -------- ------------ -------------
| | | | | |
| | | | | File Name
| | | | |
| | | | +--- Modification Time
| | | |
| | | +------------- Size (in bytes)
| | |
| | +----------------------- Group
| |
| +-------------------------------- Owner
|
+---------------------------------------------- File Permissions
----------------------------------------------------------------------------------------
* cp - copy files and directories
* mv - move or rename files and directories
* rm - remove files and directories
* mkdir - create directories
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
chmod - modify file access rights
su - temporarily become the superuser
chown - change file ownership
chgrp - change a file's group ownership
-------------------------------------------------
rwx rwx rwx = 111 111 111
rw- rw- rw- = 110 110 110
rwx --- --- = 111 000 000
------------------------------------------------
rwx = 111 in binary = 7
rw- = 110 in binary = 6
r-x = 101 in binary = 5
r-- = 100 in binary = 4
----------------------------------
[me@linuxbox me]$ chmod 600 some_file
---------------------------------------------
chown you some_file
------------------------------
to know ubuntu version
lsb_release -a
-------------------
to remove windows
sudo gedit /boot/grub/grub.cfg
-----------------------
# ps aux | grep PROCESSNAME
kill -9 process id
------------------------
rm -rf /opt/lampp
--------------------------
sudo apt-get install tasksel
-------------------------------------------
list the process/daemons with port nos..
lsof -i
---------------------------------------
cron jobs
* * * * *
1.minute (from 0 to 59)
2.hour (from 0 to 23)
3.day of month (from 1 to 31)
4.month (from 1 to 12)
5.day of week (from 0 to 6) (0=Sunday)
crontab -l will show you your currently set up cron jobs on the server.
crontab -r will delete your current cron jobs.
crontab -e will allow you to add or edit your current cron jobs by using your default editor to edit your "crontab file".
------------------------------------------------------------------------------------------------------------------------------
sudo apt-cache search tomcat
--------------------------------------------
Restart tomcat
/etc/init.d/tomcat6 restart
------------------------------------------------------------
----------------------------------------------------------
daemon -d -v perl `pwd`/server -l /tmp/k
----------------------------------------------------------
to observe particular file access...!!@!!
tail -f /var/log/apache2/access.log|grep location.php
---------------------------------------------------
export editor command
EDITOR=nano crontab -e
--------------------------------------------------
--------------------------------------
on permission denied:
aa-complain /usr/sbin/tcpdump
----------------------------------------
check whether package installed/not
dpkg -l|grep ldap
--------------------------------------------
ubuntu corrupt on start up
sudo apt-get clean
mv source destination
chmod 0777 /tmp
sudo dpkg --configure -a
mkdir /var/lib/gconf/default
sudo apt-get --reinstall install ubuntu-desktop
--------------------------------------------------------------------------------
Checked for "is another process using it?":
Code:
ps aux | egrep -i 'apt|ftp|kpack|dpkg' | less
+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_
I killed them all anyway, just to be sure:
Code:
killall -9 apt* kpackage dpkg
+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_
If you ever use synaptic (it's removed from my system), you should make that:
Code:
killall -9 apt* kpackage dpkg synaptic
+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_
Having confirmed that there were no "rogue" pkg. managers running, I checked, removed, & rechecked the lock file:
Code:
ls -l /var/lib/dpkg/lock
rm -f /var/lib/dpkg/lock
ls -l /var/lib/dpkg/lock
+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_
Finally, I ran my "fix":
Code:
aptitude safe-upgrade
-------------------------------------------------------------------------------------------
sudo apt-get install -fix
-----------------------------------------------------------------
Re: connect two ubuntu computers via crossover cable
Have you checked the firewall rules ??
iptables -L
Try switching them off.
sudo service iptables stop
Also:
sudo ufw disable
--------------------------------------------------------------
Linux Distribution version
cat /etc/*-release
----------------------------------------------------------------
pstree Processes and parent-child relationships
top Show top processes
iostat Report CPU statistics and input/output statistics for devices and partitions.
ps -auxw process status
uname -a print system information
cat /proc/version Display Linux kernel version in use.
cat /etc/redhat-release Display Red Hat Linux Release. (also /etc/issue)
uptime Tell how long the system has been running. Also number of users and system's load average.
w Show who is logged on and what they are doing.
/sbin/lsmod List all currently loaded kernel modules.
Same as cat /proc/modules
/sbin/runlevel Displays the system's current runlevel.
hostname Displays/changes the system's node name. (Must also manually change hostname setting in /etc/sysconfig/network. Command will change entry in /etc/hosts)
service Red Hat/Fedora command to display status of system services.
Example: service --status-all
Help: service --help
------------------------
list users
cat /etc/passwd
------------------------------
./configure---->queries the system and sets compilation options suitable for the hardware and software detected.
make---->compiles the code,
and sudo make install---->installs the code in system directories. By default, the directories are rooted at /usr/local,
although you can change the target root with the --prefix=/some/full/path/name option to ./configure.
-----------------------------------
To unzip a file that is only compressed with bz2 use
bunzip2 filename.bz2
to unzip things thar are compressed with .tar.bz2 use
tar -xvjpf filename.tar.bz2
http://www.cyberciti.biz/howto/question/general/compress-file-unix-linux-cheat-sheet.php
0-00000000000000000000000000000000000000000
tar a directory
tar cvzf tarball.tar.gz directory/
tar xvzf tarbar.tar.gz
------------------------------------------
list all the daemons
ps auxw-----------------------
----------------------]
Reset Gnome panel
gconftool --recursive-unset /apps/panel
rm -rf ~/.gconf/apps/panel
pkill gnome-panel