<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ls command &#8211; lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</title>
	<atom:link href="https://lifelinux.com/tag/ls-command/feed/" rel="self" type="application/rss+xml" />
	<link>https://lifelinux.com</link>
	<description>All About Linux !</description>
	<lastBuildDate>Fri, 28 Dec 2012 08:33:50 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.5.3</generator>
	<item>
		<title>10 lsof Command Examples</title>
		<link>https://lifelinux.com/10-lsof-command-examples/</link>
					<comments>https://lifelinux.com/10-lsof-command-examples/#respond</comments>
		
		<dc:creator><![CDATA[lifeLinux]]></dc:creator>
		<pubDate>Sat, 14 May 2011 16:41:13 +0000</pubDate>
				<category><![CDATA[Bash Shell]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[command line options]]></category>
		<category><![CDATA[fuser command]]></category>
		<category><![CDATA[grep command]]></category>
		<category><![CDATA[grep program]]></category>
		<category><![CDATA[internet connections]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[linux-distributions]]></category>
		<category><![CDATA[list open files]]></category>
		<category><![CDATA[ls command]]></category>
		<category><![CDATA[lsof]]></category>
		<category><![CDATA[lsof command]]></category>
		<category><![CDATA[netstat command]]></category>
		<category><![CDATA[operating system]]></category>
		<category><![CDATA[port numbers]]></category>
		<category><![CDATA[process id]]></category>
		<category><![CDATA[proto]]></category>
		<category><![CDATA[ps command]]></category>
		<category><![CDATA[running processes]]></category>
		<category><![CDATA[servers]]></category>
		<category><![CDATA[sockets]]></category>
		<category><![CDATA[udp]]></category>
		<category><![CDATA[UNIX]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=523</guid>

					<description><![CDATA[<p>The lsof command or &#8220;list open files&#8221; command in Linux is a powerful tool. In Linux and Unix everything behind the scenes are just files. This includes IP sockets, pipes, unix sockets, directories, devices, even inodes are just files. This means that lsof can actually tell you a lot of information of what is going [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://lifelinux.com/10-lsof-command-examples/">10 lsof Command Examples</a> appeared first on <a rel="nofollow" href="https://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p>The <strong>lsof command</strong> or &#8220;list open files&#8221; command in Linux is a powerful tool. In Linux and Unix everything behind the scenes are just files. This includes IP sockets, pipes, unix sockets, directories, devices, even inodes are just files. This means that lsof can actually tell you a lot of information of what is going on on your system.<span id="more-523"></span></p>
<h3>Synopsis</h3>
<pre>
lsof [ -?abChlnNOPRstUvVX ] [ -A A ] [ -c c ] [ +|-d d ] [ +|-D D ] [ +|-f [cfgGn] ] [ -F [f] ] [ -g [s] ] [ -i [i] ] [ -k k ] [ +|-L [l] ] [ -m m ] [ +|-M ] [ -o [o] ] [ -p s ] [ +|-r [t] ] [ -S [t] ] [ -T [t] ] [ -u s ] [ +|-w ] [ -- ] [names] 
</pre>
<h3>Example 1: Show all opened files</h3>
<p>Type the following command</p>
<pre>
lsof | more
</pre>
<p>Sample outputs</p>
<pre>
COMMAND     PID      USER   FD      TYPE     DEVICE      SIZE       NODE NAME
init          1      root  cwd       DIR      253,4      4096          2 /
init          1      root  rtd       DIR      253,4      4096          2 /
init          1      root  txt       REG      253,4     38652   41746599 /sbin/init
init          1      root  mem       REG      253,4    129900   16252964 /lib/ld-2.5.so
init          1      root  mem       REG      253,4   1693812   16252965 /lib/libc-2.5.so
init          1      root  mem       REG      253,4     20668   16253168 /lib/libdl-2.5.so
init          1      root  mem       REG      253,4    245376   16253222 /lib/libsepol.so.1
init          1      root  mem       REG      253,4     93508   16253815 /lib/libselinux.so.1
init          1      root   10u     FIFO       0,17                 1277 /dev/initctl
...
</pre>
<h3>Example 2: Show all opened internet sockets</h3>
<p>Using the -i flag lsof will list the internet sockets currently opened</p>
<pre>
lsof -i
</pre>
<p>Sample outputs</p>
<pre>
COMMAND     PID   USER   FD   TYPE   DEVICE SIZE NODE NAME
sshd       2537   root    3u  IPv6     5348       TCP *:rockwell-csp2 (LISTEN)
mysqld     2625  mysql   11u  IPv4     5463       TCP *:mysql (LISTEN)
httpd      2731 apache    3u  IPv6 30048993       TCP *:http (LISTEN)
...
</pre>
<h3>Example 3: Shows all networking related to a given port 80</h3>
<pre>
lsof -i :80
</pre>
<p>Sample outputs</p>
<pre>
COMMAND   PID   USER   FD   TYPE   DEVICE SIZE NODE NAME
httpd    2731 apache    3u  IPv6 30048993       TCP *:http (LISTEN)
httpd    2731 apache   58u  IPv6 39448263       TCP server.com:http->adsl-dynamic-pool-xxx.hcm.fpt.vn:23527 (ESTABLISHED)
httpd    2731 apache   60u  IPv6 39448302       TCP server.com:http->crawl-66-249-69-83.googlebot.com:35190 (ESTABLISHED)
httpd    2731 apache   61u  IPv6 39448336       TCP server.com:http->v16-13.opera-mini.net:37548 (ESTABLISHED)
httpd    2731 apache   62u  IPv6 39448388       TCP server.com:http->v16-13.opera-mini.net:37561 (ESTABLISHED)
httpd    2731 apache   64u  IPv6 39447543       TCP server.com:http->adsl.viettel.vn:13636 (FIN_WAIT2)
</pre>
<h3>Example 4: Show all TCP/UDP connections</h3>
<pre>
lsof -i TCP
</pre>
<p>Sample outputs</p>
<pre>
sshd       2537   root    3u  IPv6     5348       TCP *:rockwell-csp2 (LISTEN)
mysqld     2625  mysql   11u  IPv4     5463       TCP *:mysql (LISTEN)
httpd      2731 apache    3u  IPv6 30048993       TCP *:http (LISTEN)
...
</pre>
<h3>Example 5: List open files associated with process ID</h3>
<p>The flag +p will display all open files associated with specific process ID, example with process ID is 2625</p>
<pre>
lsof +p 2625
</pre>
<p>Sample outputs</p>
<pre>
COMMAND  PID  USER   FD   TYPE     DEVICE      SIZE     NODE NAME
mysqld  2625 mysql  cwd    DIR      253,4      4096 21495811 /var/lib/mysql
mysqld  2625 mysql  rtd    DIR      253,4      4096        2 /
mysqld  2625 mysql  txt    REG      253,4   7020300 50999198 /usr/libexec/mysqld
mysqld  2625 mysql  DEL    REG      253,4           16253135 /lib/libcrypto.so.0.9.8e.#prelink#.64u8kX
mysqld  2625 mysql  mem    REG      253,4           16252984 /lib/libm-2.5.so (path inode=16253122)
mysqld  2625 mysql  DEL    REG      253,4           50996047 /usr/lib/libgssapi_krb5.so.2.2.#prelink#.YYIHuy
mysqld  2625 mysql  mem    REG      253,4           16252990 /lib/libselinux.so.1 (path inode=16253815)
mysqld  2625 mysql  mem    REG      253,4           16256252 /lib/libsepol.so.1 (path inode=16253222)
mysqld  2625 mysql  mem    REG      253,4     50848 16253138 /lib/libnss_files-2.5.so
mysqld  2625 mysql  mem    REG      253,4           16253825 /lib/librt-2.5.so (path inode=16253220)
mysqld  2625 mysql  mem    REG      253,4           16252942 /lib/ld-2.5.so (path inode=16252964)
mysqld  2625 mysql  mem    REG      253,4           50996107 /usr/lib/libstdc++.so.6.0.8 (path inode=50989584)
mysqld  2625 mysql  mem    REG      253,4           50996061 /usr/lib/libkrb5.so.3.3 (path inode=50999803)
mysqld  2625 mysql  mem    REG      253,4           16252980 /lib/libdl-2.5.so (path inode=16253168)
...
</pre>
<h3>Example 6: Show what a given user has open</h3>
<p>The flag -u will show what a given user has open</p>
<pre>
lsof -u apache
</pre>
<p>Sample outputs</p>
<pre>
COMMAND   PID   USER   FD   TYPE     DEVICE      SIZE     NODE NAME
httpd    2731 apache  cwd    DIR      253,4      4096        2 /
httpd    2731 apache  rtd    DIR      253,4      4096        2 /
httpd    2731 apache  txt    REG      253,4   3120954 51157630 /usr/local/apache/bin/httpd
httpd    2731 apache  mem    REG      253,4    375710 51157607 /usr/local/apache/lib/libaprutil-1.so.0.3.10
httpd    2731 apache  mem    REG      253,4     45432 16253184 /lib/libcrypt-2.5.so
httpd    2731 apache  mem    REG      253,4      7748 16253849 /lib/libcom_err.so.2.1
httpd    2731 apache  mem    REG      253,4      7880 16253845 /lib/libkeyutils-1.2.so
httpd    2731 apache  mem    REG      253,4    937178 51157689 /usr/local/apache/modules/mod_security2.so
httpd    2731 apache  mem    REG      253,4    129208 16253851 /lib/libpcre.so.0.0.1
...
</pre>
<g:plusone href="https://lifelinux.com/10-lsof-command-examples/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="https://lifelinux.com/10-lsof-command-examples/">10 lsof Command Examples</a> appeared first on <a rel="nofollow" href="https://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lifelinux.com/10-lsof-command-examples/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Find Large Files In Linux</title>
		<link>https://lifelinux.com/find-large-files-in-linux/</link>
					<comments>https://lifelinux.com/find-large-files-in-linux/#respond</comments>
		
		<dc:creator><![CDATA[lifeLinux]]></dc:creator>
		<pubDate>Fri, 13 May 2011 15:54:44 +0000</pubDate>
				<category><![CDATA[Bash Shell]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[find command]]></category>
		<category><![CDATA[Find files larger than a certain size]]></category>
		<category><![CDATA[Find files within specified size limits]]></category>
		<category><![CDATA[Find Large Files]]></category>
		<category><![CDATA[ls command]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=478</guid>

					<description><![CDATA[<p>Find files larger than a certain size This example finds all the files under /root directory which are larger than 50k [root@lifelinux ~]# find /root -size +50k Sample output /root/ioncube/ioncube_loader_lin_5.3_ts.so /root/ioncube/ioncube_loader_lin_4.1.so /root/ioncube/ioncube_loader_lin_5.1.so /root/ioncube/ioncube_loader_lin_4.2.so ... Find files within specified size limits Example, type the following command to limit the search to find only files with the [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://lifelinux.com/find-large-files-in-linux/">Find Large Files In Linux</a> appeared first on <a rel="nofollow" href="https://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><h3>Find files larger than a certain size</h3>
<p>This example finds all the files under /root directory which are larger than 50k</p>
<pre>[root@lifelinux ~]# find /root -size +50k</pre>
<p>Sample output</p>
<pre>/root/ioncube/ioncube_loader_lin_5.3_ts.so
/root/ioncube/ioncube_loader_lin_4.1.so
/root/ioncube/ioncube_loader_lin_5.1.so
/root/ioncube/ioncube_loader_lin_4.2.so
...</pre>
<p><span id="more-478"></span></p>
<h3>Find files within specified size limits</h3>
<p>Example, type the following command to limit the search to find only files with the size of 50k to 100k</p>
<pre>[root@lifelinux ~]# find /var/log -size +50k -size -100k</pre>
<p>Sample output</p>
<pre>/var/log/secure.2
/var/log/munin/munin-node.log
/var/log/munin/munin-limits.log
...</pre>
<p>If you want to list them with ls, type the following command</p>
<pre>[root@lifelinux ~]# find /var/log -size +50k -size -100k -exec ls -lha {} \;</pre>
<p>Sample output</p>
<pre>-rw------- 1 root root 59K Apr 30 22:01 /var/log/secure.2
-rw-r--r-- 1 root root 54K May 13 23:05 /var/log/munin/munin-node.log
-rw-r--r-- 1 munin munin 94K May 13 23:05 /var/log/munin/munin-limits.log</pre>
<h3>Further readings</h3>
<p><a href="http://linux.about.com/od/commands/l/blcmdl1_find.htm">Find command</a></p>
<g:plusone href="https://lifelinux.com/find-large-files-in-linux/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="https://lifelinux.com/find-large-files-in-linux/">Find Large Files In Linux</a> appeared first on <a rel="nofollow" href="https://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lifelinux.com/find-large-files-in-linux/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>SUID, SGID and Sticky Bits</title>
		<link>https://lifelinux.com/suid-sgid-and-sticky-bits/</link>
					<comments>https://lifelinux.com/suid-sgid-and-sticky-bits/#respond</comments>
		
		<dc:creator><![CDATA[lifeLinux]]></dc:creator>
		<pubDate>Sun, 27 Mar 2011 03:07:02 +0000</pubDate>
				<category><![CDATA[File System]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[chmod command]]></category>
		<category><![CDATA[find SGID file]]></category>
		<category><![CDATA[Find SUID file]]></category>
		<category><![CDATA[ls command]]></category>
		<category><![CDATA[setting SGID bit]]></category>
		<category><![CDATA[Setting Sticky bit]]></category>
		<category><![CDATA[setting SUID bit]]></category>
		<category><![CDATA[SGID]]></category>
		<category><![CDATA[Sticky Bits]]></category>
		<category><![CDATA[SUID]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=271</guid>

					<description><![CDATA[<p>What are the SUID, SGID and the Sticky Bits? Sticky Bit Lets start with Sticky bit first. Since this is the most simplest to explain. Setting the sticky bit tells Unix that once the concerned application is executed, it should remain in memory. Remember that Unix is a multi-user OS and was mainly designed so [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://lifelinux.com/suid-sgid-and-sticky-bits/">SUID, SGID and Sticky Bits</a> appeared first on <a rel="nofollow" href="https://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><h2>What are the SUID, SGID and the Sticky Bits?</h2>
<h3>Sticky Bit</h3>
<p>Lets start with Sticky bit first. Since this is the most simplest to explain. Setting the sticky bit tells Unix that once the concerned application is executed, it should remain in memory. Remember that Unix is a multi-user OS and was mainly designed so that multiple users can work simultaneously. Thus the logic used is that a program that exists in memory requires lesser time to start when a new user requests for the same program. Thus when one user has just used a program and then a new user wants to use the same program, the second user doesn&#8217;t have to face a time delay for the program to initialize itself. It would be readily available to him. The concept of the sticky bit was a very useful one, long back when fast disk access and other memory access technologies weren&#8217;t around. But in today&#8217;s age the concept of sticky bit is obsolete, since modern day technology is advanced enough to reduce the time delay while loading applications into the memory. Thus currently the sticky bit is of very little significance. Sticky bit is only associated with executables.<span id="more-271"></span></p>
<h3>SUID (Set User ID) Bit</h3>
<p>Sometime you may faced an error while trying to run any application stating that the application must be &#8216;SUID root&#8217; . You might have been confused that time, but now once you read this article you would no longer find it confusing.</p>
<p>SUID stands for Set User ID. This means that if the SUID bit is set for any application then your user ID would be set as that of the owner of application/file rather than the current user, while running that application. That means in case I have an application whose owner is &#8216; root &#8216; and it has its SUID bit set, then when I run this application as a normal user, that application would still run as root. Since the SUID bit tells Linux that the the User ID root is set for this application and whenever this application executes it must execute as if root was executing it (since root owns this file).</p>
<h3>SGID (Set Group ID) bit</h3>
<p>Just like SUID, setting the SGID bit for a file sets your group ID to the file&#8217;s group while the file is executing. IT is really useful in case you have a real multi-user setup where users access each others files. As a single homeuser I haven&#8217;t really found a lot of use for SGID. But the basic concept is the same as the SUID, the files whose SGID bit are set would be used as if they belong to that group rather than to that user alone.</p>
<h2>Setting the SUID/SGID bits</h2>
<p><a href="http://www.lifelinux.com/wp-content/uploads/2011/03/sed1.png"><img loading="lazy" class="aligncenter size-medium wp-image-275" title="SUID, SGID and Sticky Bits" src="http://www.lifelinux.com/wp-content/uploads/2011/03/sed1-300x114.png" alt="SUID, SGID and Sticky Bits" width="300" height="114" srcset="https://lifelinux.com/wp-content/uploads/2011/03/sed1-300x114.png 300w, https://lifelinux.com/wp-content/uploads/2011/03/sed1.png 650w" sizes="(max-width: 300px) 100vw, 300px" /></a><br />
<strong>Setting SUID bits on the file:</strong><br />
Suppose I got the executable called &#8220;killprocess&#8221; and I need to set the suid bit on this file, go to command prompt and issue command:</p>
<pre>chmod u+s filename</pre>
<p>Now check permission on the file with command</p>
<pre>ls -l filename</pre>
<p>Observe &#8220;s&#8221; that has been added for suid bit</p>
<pre>-rwsr-xr-x 1 root root 8 Jun  8 10:10 filename</pre>
<p><strong>Setting GUID bits on the file:</strong><br />
Go to command prompt and issue command:</p>
<pre>chmod g+s filename</pre>
<p>This will set the GUID bit on the same file, check the permission on this file using command:</p>
<pre>ls -l filename</pre>
<pre>-rwsr-sr-x 1 root root 8 Jun  8 12:11 filename</pre>
<p><strong>Setting Sticky bits on the folder:</strong></p>
<pre>chmod +t folder</pre>
<h2>Find SUID/SGID files</h2>
<p><strong>Find all SUID root files:</strong></p>
<pre>find / -user root -perm -4000 -print</pre>
<p><strong>Find all SGID root files:</strong></p>
<pre>find / -group root -perm -2000 -print</pre>
<p><strong>Find all SUID and SGID files owned by anyone:</strong></p>
<pre>find / -perm -4000 -o -perm -2000 -print</pre>
<g:plusone href="https://lifelinux.com/suid-sgid-and-sticky-bits/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="https://lifelinux.com/suid-sgid-and-sticky-bits/">SUID, SGID and Sticky Bits</a> appeared first on <a rel="nofollow" href="https://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lifelinux.com/suid-sgid-and-sticky-bits/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
