Difference between revisions of "User:Scott/03"

From FreekiWiki
Jump to navigation Jump to search
 
(5 intermediate revisions by the same user not shown)
Line 15: Line 15:
 
[[#top|top]]
 
[[#top|top]]
  
==Favorite Commands==
+
=Useful Commands to Remember=
*history (!2054)
+
==history (!2054)==
*gksudo nautilus /home
+
==gksudo nautilus /home==
*gconf-editor (configuration)
+
==gconf-editor (configuration)==
*run-cmd-in-background $ sudo gedit xxxx &
+
==run-process-in-background== 
 +
*sudo gedit xxxx &
  
==File Attributes==
+
<pre>
  ls -l  
+
  ls -l                             ls –F
  d = directory
+
  d = directory                      / = sub-directory
  l = symbolic link
+
  l = symbolic link                 @ = linked_file
  b or c = device block or char
+
  b or c = device block or char     * = executable_file
  n = named pipe
+
  n = named pipe                    | = named pipe
  s = socket
+
  s = socket                         = socket
 +
</pre>
  
  ls –F
+
=ls [switches]=
  @ = linked_file
+
ls -a [-a all]
  * = executable_file
+
ls -R [-R recursive subfolders] 
  / = subdirectory
+
  ls -t [-t sort by time]
  = socket
+
  ls -i [-i inode]
  | = named pipe
+
  ls -n [-n UID & GID]
 +
  ls -r [-r reverse order]
 +
  ls -1 [-1 line by line]
 +
  ls -F [-F */=@|]
  
==File Directory Tree==
+
=Permissions for Directories and Files=
ls -Ra  [-R recursive] [-a all]
 
ls -ti  [-t sort by time] [-i inode]
 
ls -nr  [-n UID & GID] [-r reverse order]
 
ls -1F  [-1 line by line] [-F */=@|]
 
  
==File Permissions==
+
==Owner & Groups==
===Change Owner & Group===
 
 
  chgrp
 
  chgrp
 
  chown -R root:root folder-name
 
  chown -R root:root folder-name
 
  chown oem:oem file-name
 
  chown oem:oem file-name
  
===Change Folder & File===
+
==rwx Attributes==
 
  chmod 774 folder-name (rwxrwxr--)
 
  chmod 774 folder-name (rwxrwxr--)
 
  chmod 664 file-name  (rw-rw-r--)
 
  chmod 664 file-name  (rw-rw-r--)
Line 54: Line 54:
 
  chmod ugo-rwx /dir/file
 
  chmod ugo-rwx /dir/file
  
==Process (running & idle)==
+
=Active Process (list)=
 
  ps -l (bash)
 
  ps -l (bash)
 
  ps -e [-e all processes] [-f full-listing]  
 
  ps -e [-e all processes] [-f full-listing]  
  
==Directory Size==
+
=Directory/File Size=
 
  du -h  (-h human readable)
 
  du -h  (-h human readable)
 
  du -hc  (-c Directory Total Size)
 
  du -hc  (-c Directory Total Size)
Line 64: Line 64:
 
  sudo du -ch --max-depth=1  /home/ (include /home/xxx)
 
  sudo du -ch --max-depth=1  /home/ (include /home/xxx)
  
==Directory File Usage==
+
==variations==
  
 
  du -h | less                (-h human readable)
 
  du -h | less                (-h human readable)
Line 74: Line 74:
 
[[#top|top]]
 
[[#top|top]]
  
==Search Locate Find==
+
=Locate & Find Commands=
 +
 
 +
==Find an Application==
 
  whereis [program]
 
  whereis [program]
 
  which  [program]
 
  which  [program]
  
 +
==Locate a File==
 
  sudo updatedb
 
  sudo updatedb
  locate /dir/dir | grep file
+
  locate file-name
  find -name filename ???
+
  locate file-name | grep xxx
  
==COPY MOVE==
+
=Copy & Move Commands=
 
  cp -vr Source ~/Destination  (-r pr -R recursively)  
 
  cp -vr Source ~/Destination  (-r pr -R recursively)  
 
  mv -v  Source ~/Destination  (-r not necessary)
 
  mv -v  Source ~/Destination  (-r not necessary)
 
  rm -rivf Desktop/ /home/dir [rmdir + content] [-i prompt] [-f force]
 
  rm -rivf Desktop/ /home/dir [rmdir + content] [-i prompt] [-f force]
  
==Symbolic Lnk==
+
=Find the Difference Between Two Files=
 +
diff file1 file2
 +
 
 +
=Symbolic Link (create)=
 
  ln –s target linkname (symbolic link)
 
  ln –s target linkname (symbolic link)
  
==Difference between two files==
+
=TAR & .ZIP=
diff file1 file2
 
 
 
==.TAR & .ZIP==
 
 
gzip file (zips)
 
gzip file (zips)
 
gunzip file (unzips)
 
gunzip file (unzips)
Line 103: Line 106:
 
tar -xzvf NameOfArchive.tar.gz                       (unpack & unzip)
 
tar -xzvf NameOfArchive.tar.gz                       (unpack & unzip)
  
==whoami==
+
=whoami=
 
  finger (who is logged in)
 
  finger (who is logged in)
 
  id (uid=1000(sjnSUSE) gid=100(users) groups=100(users)
 
  id (uid=1000(sjnSUSE) gid=100(users) groups=100(users)
Line 110: Line 113:
 
[[#top|top]]
 
[[#top|top]]
  
==echo $PATH==
+
=echo $PATH=
 
  A list of directories your shell searches through when you enter a command
 
  A list of directories your shell searches through when you enter a command
  
Line 121: Line 124:
 
  /usr/games
 
  /usr/games
  
==MAN Pages==
+
=Find MAN Pages=
 
  man –k whoami (look-up commands)
 
  man –k whoami (look-up commands)
 
  info whoami
 
  info whoami
 
  help whoami
 
  help whoami

Latest revision as of 00:18, 12 January 2012

  Directories & Files
--------------------------------
Home Page      user:scott
Tech Support   user:scott/02
Dir & Files    user:scott/03
Network        user:scott/04
Troubleshoot   user:scott/05
Laptops        user:scott/06
Resources      user:scott/07
Notes          user:scott/08 

Template:TOC limit

top

Useful Commands to Remember

history (!2054)

gksudo nautilus /home

gconf-editor (configuration)

run-process-in-background

  • sudo gedit xxxx &
 ls -l                              ls –F 
 d = directory                      / = sub-directory
 l = symbolic link                  @ = linked_file
 b or c = device block or char      * = executable_file
 n = named pipe                     | = named pipe
 s = socket                         = socket

ls [switches]

ls -a [-a all]
ls -R [-R recursive subfolders]  
ls -t [-t sort by time] 
ls -i [-i inode] 
ls -n [-n UID & GID] 
ls -r [-r reverse order]
ls -1 [-1 line by line] 
ls -F [-F */=@|]

Permissions for Directories and Files

Owner & Groups

chgrp
chown -R root:root folder-name
chown oem:oem file-name

rwx Attributes

chmod 774 folder-name (rwxrwxr--)
chmod 664 file-name   (rw-rw-r--)
chmod ugo+rwx /dir/file
chmod ugo-rwx /dir/file

Active Process (list)

ps -l (bash)
ps -e [-e all processes] [-f full-listing] 

Directory/File Size

du -h   (-h human readable)
du -hc  (-c Directory Total Size)
sudo du -ch  (include .hidden files)
sudo du -ch --max-depth=1  /home/ (include /home/xxx)

variations

du -h | less                 (-h human readable)
du -h /home/bob/Downloads/   (dir. in Download)
du -ha /home/bob/Downloads/  (files & dir. in Download)
du -ha /home/bob/Downloads/ | grep -i firefox   (find all instances of firefox and -i ignore case)

top

Locate & Find Commands

Find an Application

whereis [program]
which   [program]

Locate a File

sudo updatedb
locate file-name
locate file-name | grep xxx

Copy & Move Commands

cp -vr Source ~/Destination  (-r pr -R recursively)	  	
mv -v  Source ~/Destination  (-r not necessary)
rm -rivf Desktop/ /home/dir [rmdir + content] [-i prompt] [-f force]

Find the Difference Between Two Files

diff file1 file2

Symbolic Link (create)

ln –s target linkname (symbolic link)

TAR & .ZIP

gzip file (zips) gunzip file (unzips)

tar -cvf NameOfArchive.tar file1 + dir1 + file2 (pack) [-c create] [-f ???] tar -xvf NameOfArchive.tar (unpack) [-x extract]

tar -czvf NameOfArchive.tar.gz  file1 + dir1 + file2 (pack & zip) tar -xzvf NameOfArchive.tar.gz (unpack & unzip)

whoami

finger (who is logged in)
id (uid=1000(sjnSUSE) gid=100(users) groups=100(users)
date & cal

top

echo $PATH

A list of directories your shell searches through when you enter a command
/usr/local/sbin:
/usr/local/bin:
/usr/sbin:
/usr/bin:
/sbin:
/bin:
/usr/games

Find MAN Pages

man –k whoami (look-up commands)
info whoami
help whoami