a shortcut for linux( from linux journal )

本文介绍了在Linux系统中如何创建目录和文件的符号链接(symlinks),以实现快速访问。通过具体实例展示了如何使用命令行工具mkdir和ln来创建指向特定位置的链接,并解释了符号链接与硬链接之间的区别。
if you come from the world of Windows, you undoubtedly understand the concept of a shortcut. In the Linux world, shortcuts do exist, but they're generally referred to as symbolic links, or symlinks. They are so named because, like shortcuts, a symlink is really just a symbolic placeholder or link to the file or directory you're trying to get at.

Of course, the world of pretty graphics and windows provides ways of creating symlinks. However, for the impatient, the command line allows you to do the job with less clicking around. Let's have a look at an example.

Suppose I'm working on a Web site, and I want all of the Web site files to be located in /home/jonesy/public_html/websites/testing/site1. I need to have quick access to this directory on a pretty regular basis, so it would be nice to have a shortcut on my desktop so I can get to it in a single click. It also would be nice to be able to drag files to the folder without having to browse to it first.

In this scenario, we call /home/jonesy/public_html/websites/testing/site1 the source directory, and I create that directory using the mkdir command. Follow along at home:

mkdir -p /home/jonesy/public_html/websites/testing/site1

Remember to change jonesy to your own login name.

Again, we've just created the source directory. The mkdir command creates a directory anywhere you have permission to do so. The -p option tells mkdir to create any parent directories along the way that don't already exist.

We call the symlink itself the target, and it points to the source we just created. Note that we can call the target whatever we want. In this case, I just call it site1. To make a link that shows up on my desktop, I open up Konsole and run the following command:

@cx:ln -s /home/jonesy/public_html/websites/testing/site1</n>/home/jonesy/Desktop/site1

Again, remember to change jonesy in the above command to your own login name.

The ln command can make other types of links besides symbolic links, so it's important to remember to feed it the -s option to let it know that you want to create a symbolic link. Though it happens, it is relatively rare to use the ln command without the -s option, even for hard-core geeks.

For Aspiring Geeks
If you forget the -s option, you'll create what's called a hard link. Though the differences are subtle, they are significant. Depending on the location of the link in relationship to the source, you can generate an error, because hard links cannot cross drive partition boundaries. In the guts of the system, the plain facts are that a hard link is actually just another alternative name for the same bunch of data stored somewhere on the disk (in technical terms, the hard link and the original file would point to the same inode).

But Wait! There's More!

Of course, making a link to a particular file is exactly like making a link to a directory. So, if I want to make a link to my favorite photo (/home/jonesy/Photos/mypic.jpg) on my desktop, I can do it like this:

ln -s /home/jonesy/Photos/mypic.jpg /home/jonesy/Desktop/

I threw in a little trick in the above command. Because I didn</#213>t want the symlink to have a different name from the file it points to, I simply use a . (period), which is shorthand for saying, don't change the name.

For more information about the ln command, try running

man ln

, which is the manual or man page for the ln command.

About the Author

Brian Jones is a system/network/database administrator and sometime Web developer for the Computer Science Department at Princeton University. He is also a freelance writer and editor, spending most of his freelance time writing about technology for various Web and print publications. In his free time, he enjoys brewing beer, home recording and playing billiards.
### Linux System Shortcut Offload Configuration and Usage In the context of network processing, offloading refers to delegating certain tasks from the CPU to specialized hardware components such as Network Interface Cards (NICs). This can significantly reduce the load on the main processor by handling operations like checksum calculations, segmentation, or even more complex functions directly within the NIC. For configuring shortcuts or offloads in a Linux environment, several parameters are available through ethtool—a powerful utility that allows querying and controlling various settings related to Ethernet devices. The following sections provide an overview of how these configurations work: #### Checking Current Offload Settings To view current offload settings for a specific interface named `eth0`, one would use: ```bash ethtool -k eth0 ``` This command displays all possible features along with their status—whether they're enabled (`on`) or disabled (`off`). Features include TCP Segmentation Offload (TSO), Generic Receive Offload (GRO), Large Receive Offload (LRO), etc.[^1] #### Enabling/Disabling Specific Offloads If changes need to be made to any particular feature, this can also be accomplished using `ethtool`. For example, disabling TSO could look something like this: ```bash sudo ethtool --offload eth0 tso off ``` Similarly, enabling GRO might involve running: ```bash sudo ethtool --offload eth0 gro on ``` These commands allow administrators fine-grained control over which aspects of packet processing should occur at the driver level versus being handled entirely by software stacks higher up in the networking stack hierarchy[^1]. #### Persistent Configuration Across Reboots Changes applied via `ethtool` do not persist across reboots unless explicitly saved into configuration files depending upon distribution specifics. On systems utilizing systemd-networkd service manager, adding entries under `[Network]` section inside `/etc/systemd/network/*.network` file may help achieve persistence. On other distributions where traditional init scripts manage interfaces, appending appropriate options within relevant script located usually around `/etc/sysconfig/network-scripts/ifcfg-*`.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值